Unicode with answer file and manipulating text fields
Tuviah Snyder
tuviah at runrev.com
Thu Sep 18 13:59:12 EDT 2003
> The following code will display a path which looks like
> "/Users/tdevore/desktop/JAPANESE_CHARACTERS" on the first line of the
> field but will not work for multiple lines. It places everything on
> the first line or causes Rev to hang. The code works fine without
> unicode text. tNextLine is the line that should be inserted into.
>
> set textFont of line tNextLine of field "movieList" to ",Japanese"
> put uniEncode (tNewMovieName & tab & pMoviePath, "Japanese") into
> tNewMovieName
> set unicodeText of line tNextLine of field "movieList" to tNewMovieName
Problem here is that one of your unicode characters may contain the newline
character and therefore Rev is returning the wrong line offsets (because the
chunk stuff is still working in ASCII mode). Support for unicode chunks is
planned in the near future but you can look at 'Unicode Text Manipulation
Samples' in the developers contributions library for sample scripts to roll
your own unicode compatible parsing routines.
I would also suggest for this sort of things getting the unicodetext of a
field, modifying it, and then resetting it.
> Also, how do I get the proper encoding to use for a string which I get
> from answer file? My system is English but the string has Japanese
> encoded characters and it appears it has to have the language setting
> as Japanese when encoded?
To parse shift JIS files, and get as unicode you can use
put uniencode(textoffile,"japanese")
Tuviah Snyder <tuviah at runrev.com> <http://www.runrev.com/>
Runtime Revolution Limited - Software at the Speed of Thought
More information about the use-livecode
mailing list