Escrevendo texto UTF8 em arquivo
Estou usando a seguinte função para salvar texto em um arquivo (no IE-8 com ActiveX).
function saveFile(strFullPath, strContent)
{
var fso = new ActiveXObject( "Scripting.FileSystemObject" );
var flOutput = fso.CreateTextFile( strFullPath, true ); //true for overwrite
flOutput.Write( strContent );
flOutput.Close();
}
O código funciona bem se o texto for totalmente latino-9, mas quando o texto contiver até um único caractere codificado em UTF-8, a gravação falhará.
O ActiveX FileSystemObject não suporta UTF-8, ao que parece. Tentei codificar o texto UTF-16 primeiro, mas o resultado foi ilegível. O que é uma solução alternativa?