[F-Script-talk] Patch to allow full unicode string constants.
Brought to you by:
pmougin
From: Niko M. <ni...@al...> - 2008-03-19 09:32:09
|
Hello, I am considering using FScript to add some scriptability to one of my Cocoa applications, but I really need the ability to parse full unicode string constants. I was looking at the FScript 2.0 sources (I also want garbage collection, and my scripting needs are pretty simple so I haven't run across ny abugs yet), and I modified the FSCompiler so that it expects a UTF-8 encoded input string. I also modified invocation sites to use UTF8String rather than cString, or ISOLatin1 encoding. The patch is actually pretty small (I have attached it if you are interested). There are probably some mistakes, but I think that it will catch attempts to use non-ASCII characters outside of a string constant and report an error. I had originally intended to modify the FSCompiler to operator from an NSString instead of a char*, but this seemed easier and it did not raise any kind of backwards compatibility issues (I was not sure if there were any other callers of the FSCompiler compileCode: methods besides those obvious in the code base, so changing from a char* to an NSString* might break them). Of course, it would always be possible to add new methods (compileCodeString: or some such). I figure that since all previous inputs were restricted to the ASCII character set, switching to UTF-8 does not really introduce backwards compatibility issues, all though I suppose there could be users even today with accented characters or something like that. Anyhow, thank you for all your great work on F-Script! Niko |