For handling Japanese text, these functions (below) by Kenji Kojima have served perfectly for years. (Many thanks again, Kenji!)
-- Nicolas Cueto on mouseUp answer file "Open unicode file:" if it is empty then exit mouseUp put url ("binfile:" & it) into tURL set the useUnicode to true if baseConvert(charToNum(char 1 to 2 of tURL), 10, 16) = "FEFF" then delete char 1 to 2 of tURL end if replace (uniencode(CRLF)) with (uniencode(CR)) in tURL set the unicodeText of fld "theUnicodeText" to tURL put the number of lines in tURL into tLineCount repeat with tLineNum = 1 to tLineCount put unicodeGetChars(theUnicodeText,tLineNum,1,-1) into tTemp put unidecode(tTemp,japanese) into tSJIS set the itemDel to tab get item 2 of tSJIS put it & cr after tRez end repeat delete the last char of tRez set the unicodeText of fld "questionList" to uniencode(tRez,Japanese) end mouseUp -- START OF KENJI KOJIMA'S FUNCTIONS function countUnicodeLines @tdata put number of characters of tdata into tlength set useunicode to true put 1 into tlinecount repeat with i = 1 to tlength step 2 if chartonum(char i to i+1 of tdata) is 10 then add 1 to tlinecount end repeat return tlinecount end countUnicodeLines function UnicodeLineOffset @tdata,pWhichline put number of characters of tdata into tlength set useunicode to true put 1 into tlinecount put 1 into tlineoffset repeat with i = 1 to tlength step 2 if tlinecount is pWhichline then exit repeat if chartonum(char i to i+1 of tdata) is 10 then add 1 to tlinecount put i+2 into tlineoffset end if end repeat if pWhichline > tlinecount then put tlength + 1 into tlineoffset return tlineoffset end UnicodeLineOffset function unicodeGetChars pFldname, pLineNum, pStartChar, pEndChar put the unicodetext of fld pFldname into tdata put UnicodeLineOffset(tdata,pLineNum) into startchar put UnicodeLineOffset(tdata,pLineNum+1) - 1 into endchar put (char startchar to endchar of tdata) into tLineData if pEndChar<0 then put (the num of chars of tLineData \ + (pEndChar*2))/2 into pEndChar set the useunicode to true if pLineNum = countUnicodeLines(tdata) then repeat with i = (pStartChar*2-1) to (pEndChar)*2 step 2 put char i to i+1 of tLineData after tString end repeat else repeat with i = (pStartChar*2-1) to (pEndChar-1)*2 step 2 put char i to i+1 of tLineData after tString end repeat end if return tString end unicodeGetChars ////////// E N D ///////////////////////////////////////////// _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode