如何通过编码UTF-8将文本写入文件?

D T*_*D T 1 extendscript

我的代码在Adobe Script(.jsx)中将文本写入文件:

 var xml=  " ?????? Pro"

  var file = new File(output);
  file.open("w");   
  file.write(xml);
  file.close();
Run Code Online (Sandbox Code Playgroud)

但是结果编码UTF-8无法显示: ?????? Pro 它只能显示文本 " ?????? Pro",如果设置了文件编码Shift-JIS.

如何通过编码UTF-8将文本写入文件?

lox*_*xxy 9

试试这个:

file.encoding = "UTF-8";
Run Code Online (Sandbox Code Playgroud)

这里是一个样本,以供参考.