Как программно установить кодировку создаваемому документу

Статус
Закрыто для дальнейших ответов.

quux

Участник
Топикстартер
Сообщения
33
Реакции
0
Скрипт создает файл-описание xml. Необходимо устанавливать при сохранении кодировку UTF8. Можно ли это сделать в скрипте?
 

_MBK_

Пикирующий бомбардировщик
15 лет на форуме
Сообщения
33 235
Реакции
10 852

qsedftghk

фея
15 лет на форуме
Сообщения
2 032
Реакции
1 198
Код:
File object properties

encoding    String

Gets or sets the encoding for subsequent read/write operations. One
of the encoding constants listed in “File and Folder Supported
Encoding Names” on page 42. If the value is not recognized, uses the
system default encoding.
A special encoder, BINARY, is used to read binary files. It stores each
byte of the file as one Unicode character regardless of any encoding.
When writing, the lower byte of each Unicode character is treated as
a single byte to write.
стр. 46, Javascript tools guide cs3
 
  • Спасибо
Реакции: quux

quux

Участник
Топикстартер
Сообщения
33
Реакции
0
Спасибо. Воспользовался свойством файла encoding:

Код:
fileVars = new File('D:\description.xml');
fileVars = fileVars.saveDlg('','*.xml');

if(fileVars)
{
    fileVars.open('w:');
    fileVars.encoding = 'UTF8';
    fileVars.write(strLayers);
}
 
Статус
Закрыто для дальнейших ответов.