1

It looks like the KNS database tables aren't set to unicode. When I try to put unicode chars into my rules (in notify or emit, for example) they don't output in the browser correctly when the rules fire. For instance the utf-8 character "⤵" comes out like "⤵".

Would it be possible in the future to allow unicode in rules?

Code used:

notify("<a style=\"font-size:1.3em;color:#FFF;\" href=\"http://solid1pxred.com/this_just_in\">THIS JUST IN⤵</a>", str) with width = 500 and sticky = true and opacity = 1;
flag
I'm looking into your question right now. – Mike Grace Feb 5 at 4:36
Our guys say that the system does support utf-8 characters so would you be willing to update your answer to include the code that is producing these results. A simplified app to show this behavior would be perfect. Thanks! : ) – Mike Grace Feb 5 at 4:43
Sure, I just emailed you back with a snippet Mike. (LMK if you would like the entire rule.) I wonder if this is just caused by a response header somewhere. – tiegz Feb 5 at 16:26
Awesome! Thanks for your response and I hope this helps. – Mike Grace Feb 5 at 17:07

2 Answers

2

Thanks for sending me the code you were using. I tried it out by creating a test application and was unable to reproduce the results you are getting. Everything is working for me as expected. Here is the app that I wrote and what the results looked like.

Example app

ruleset a60x142 {
  meta {
    name "utf-8 test"
    author "Mike Grace"
    description <<
      testing to see if utf-8 characters work
    >>
    logging on
  }
  dispatch {
    domain "example.com"
  }
  rule notify_test is active {
    select using ".*" setting ()
    every {
      notify("utf-8 character test", "⤵") with sticky = true;
      notify("<a style='font-size:1.3em;color:#FFF;' href='http://solid1pxred.com/this_just_in'>THIS JUST IN⤵</a>", "Cool message") with sticky = true;
    }
  }
}

Results

notify example results

If...

If you continue to have problems with the utf-8 characters not working, please share the entire app code and the urls that you are firing the rule on and getting those results. Hope this helps in some way. ; )

link|flag
great! Thanks, I'll try this out in my rule this weekend. – tiegz Feb 5 at 17:17
Look forward to hearing how it goes. – Mike Grace Feb 5 at 17:59
AHA! Figured it out tonight. I tried this rule on a news sites and it worked on all except for CNN.com (the original site I was using for testing), so I was able to narrow it down to CNN. It turns out their pages are surprisingly encoded in ISO-8859-1 instead of UTF-8. So when the page makes requests it asks for ISO-8859-1 in the "Accept-Charset" request header (at least in Firefox & Safari). I think I can get around this by just setting a special condition for CNN when I'm using special characters. – tiegz Feb 10 at 3:21
Good to hear you found what was causing all of the trouble. Thanks for letting us know what was going on. – Mike Grace Feb 10 at 6:10
1

Whenever you run into UTF-8 (Unicode) issues, the first thing that you need to check is your browser's encoding. Most browsers will default to ISO-8859-1 (Western).

What you ran into is the second thing to look for: mixed character encodings. You might want to see if CNN supports a UTF-8 flag. UTF-8 is the IETF's preferred encoding.

link|flag

Your Answer

Get an OpenID
or

Not the answer you're looking for? Browse other questions tagged or ask your own question.