Since Active4D pretty much hides the details of Unicode and UTF-8, I really don't have much more than an overview of these standards. I'm playing around again with a JSON parser for 4D. I just want to clarify a few things about how all this ties together.
Let's say I have two sites on one server. One an Active4D site and the other a Ruby on Rails site. Both use Apache as the front end with rewrite rules to direct traffic. Each site has a pseudo web service controller that allows data to be passed back and forth between the applications using JSON as the transport mechanism. >From Active4D to RoR, things are fairly straight forward. I can use the >a4d.json library to create the valid JSON object and then use >ActiveSupport::JSON.decode(json) to create the Ruby object from the JSON >object. Going the other way is what I'm trying to get right with the parser, >mainly with strings. >From the JSON description: "A string is a collection of zero or more Unicode >characters, wrapped in double quotes, using backslash escapes." The string >definition then goes on with "any Unicode character except " or \ or control >character" is passed through with everything else being backslash escaped. The a4d.json.encodeString function does all the work. It creates the backslash escapes and the \u0000 representation for other control characters, then coverts to UTF-8 using "mac to utf8()". Even though I should not have any high ascii characters (or Unicode > 127), there is nothing stopping a user from copying and pasting stuff from a Word document into a textarea, so I have to expand my simple solution to one that lives in the world of Unicode. All this intro to get to my question/clarification! If I am going to parse something coming from RoR to 4D and write a myjson.decodeString function, t would have to: 1. Call "utf8 to mac" to convert the Unicode characters. 2. Convert the \ escape representations to characters, including the \u0000 format. Is that all I have to do? Steve _______________________________________________ Active4D-dev mailing list [email protected] http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/
