SpiderMonkey supports two modes for translating code points > 0x7f into C strings, which APE uses to communicate with the log file, mysql, etc.
One way is to convert from Unicode to ISO-8859-1, throwing out any characters over 0xff. This is the default, and I suspect this is what APE uses. The other way is to convert from Unicode to UTF-8. You switch from the default with the function call JS_SetCStringsAreUTF8(). This call MUST be made before the first call to JS_InitRuntime(). I suggest you spend a little bit of time investigating this and see if you can get UTF8 output on your screen with print() statements or something. If you learn anything, a follow-up to the newsgroup would be appreciated. Note that it is possible to introduce bugs by making this change, depending how APE was written. If APE ever decides to allocate X bytes for a string with X characters, there will be a buffer overrun for any characters > 0x7f, because they use more than one byte in UTF-8. Wes On 22 December 2011 11:23, Erick Romero <[email protected]> wrote: > ** > I have not went inside the APE code, so I am don't know about the unicode > flag you are talking about or if if does/doesn't support unicode from the > outbox. > > I am using the latest APE version downloaded from GIT (aped-1.1.2-dev) and > I did compile it myself (just by running sh build.sh) > > In my case I get unicode text doing what I wrote below. In the server > side you do not have to encode / escape anything because APE does that > automatically on every message it sends. I tested "שלום" on my > implementation and I am getting it fine: > [image: 1] > > > On 12/22/2011 03:35 AM, Nicolas Guibert wrote: > > There was something weird that we noted a while ago. You need to escape > one way but not unescape the other way. Or whatever it was (decode or > escape?). > > This confused me at first. It may be the same problem. Search on this > forum. You should find what I am talking about. > > > > 2011/12/22 oferbar <[email protected]> > >> Hi Erick, >> Thanks for answering. >> What version of APE are you using and did you compile it your self? >> >> However, the problem I'm having is on the server side, not the client. >> >> The MySql database and table are in utf-8/utf-bin format. >> >> The client side code is doing escape and then the APE-JSF is doing >> encodeURIComponent. >> So on the server side Javascript I'm getting the string *double* >> encoded. >> >> To get back the original string I do this: >> >> msg = unescape(decodeURIComponent(params.msg)); >> >> and then print that to the log and write to the database. >> >> What I get is a gibberish string like this: éÜÕÝ >> and not the Hebrew text: שלום >> >> That;s why I suspect that the APE server is not fully supporting >> Unicode, and my question is still open is this is true, >> and if so how to fix that? >> >> Thanks! >> >> Ofer >> >> >> On Dec 21, 8:08 pm, Erick Romero <[email protected]> wrote: >> > In my implementation I am able to chat using unicode test such as "埃里克" >> > >> > Receiver: (client-side) >> > >> > onRawData: function(raw) { >> > this.fireEvent('onChatLog', {'w': '', 't': >> > unescape(decodeURI(raw.data.msg)), 'b': true}); >> > >> > }, >> > >> > onChatLog event what do is to add the text gotten into a "div" >> > >> > If you are storing into MySQL before send back the test with APE, you >> > should take a look if the table storing the text supports unicode >> (utf-8) >> > >> > On 12/21/2011 09:23 AM, oferbar wrote: >> > >> > >> > >> > >> > >> > >> > >> > > Hi, >> > >> > > We've got a system based on Ape 1.0 for chat. >> > >> > > Now I'm trying to add some Unicode language support for Hebrew, >> > > Korean, etc. >> > >> > > However, on the server I have a JavaScript command that receives a >> > > message and saves that to a MySql database. >> > > The command get a Hebrew string like this: "%u059e%u0592", but when I >> > > execute unescape(string) I get gibberish characters instead of the >> > > Hebrew ones. >> > >> > > I suspect that APE doesn't support Unicode string. >> > >> > > Is this correct? >> > >> > > I also tried to run a build of APE server, and I didn't see that the >> > > compilation flag UNICODE was included on any compile line, which led >> > > me to believe I need to rebuild APE with Unicode support. >> > >> > > Any help on that would be appreciated! >> > >> > > Thx >> > >> > > Ofer >> >> -- >> You received this message because you are subscribed to the Google >> Groups "APE Project" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/ape-project?hl=en >> --- >> APE Project (Ajax Push Engine) >> Official website : http://www.ape-project.org/ >> Git Hub : http://github.com/APE-Project/ >> > > -- > You received this message because you are subscribed to the Google > Groups "APE Project" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/ape-project?hl=en > --- > APE Project (Ajax Push Engine) > Official website : http://www.ape-project.org/ > Git Hub : http://github.com/APE-Project/ > > > -- > You received this message because you are subscribed to the Google > Groups "APE Project" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/ape-project?hl=en > --- > APE Project (Ajax Push Engine) > Official website : http://www.ape-project.org/ > Git Hub : http://github.com/APE-Project/ > -- Wesley W. Garland Director, Product Development PageMail, Inc. +1 613 542 2787 x 102 -- You received this message because you are subscribed to the Google Groups "APE Project" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/ape-project?hl=en --- APE Project (Ajax Push Engine) Official website : http://www.ape-project.org/ Git Hub : http://github.com/APE-Project/
<<1.png>>
