writeln using non-English characters

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
ajk48n
Posts: 20
Joined: January 17th, 2007, 3:02 pm

March 4th, 2014, 8:36 am

I'm having a problem writing a line to a file when the text is a non-english character.

For instance, I run the following

Code: Select all

var presetFile = File.saveDialog("Select a file...");
presetFile.open("w","TEXT","????"); 

var english = "A";
var chinese = "喜";

writeTestEnglish = presetFile.writeln(english);
writeTestChinese = presetFile.writeln(chinese);

presetFile.close();
writeTestEnglish will be True, and writeTestChinese will be False

Does anyone have an idea how to fix this?

Thanks,
Adam
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

March 19th, 2014, 4:39 am

This seems to work ok.

Paul

Code: Select all

var presetFile = File.saveDialog("Select a file...");

presetFile.encoding = "UTF-8";
presetFile.open("w","TEXT","????"); 

var english = "A";
var chinese = "喜";

writeTestEnglish = presetFile.writeln(english);
writeTestChinese = presetFile.writeln(chinese);

presetFile.close();
Post Reply