Write text file with BOM
import neko.io.File; import neko.io.FileOutput; import neko.FileSystem; class FileUtils { /** Write out a text file with correct BOM for UTF-8 encoding */ public static function writeTextFileWithBOM(text:String,filePath:String):Void { var f:FileOutput=File.write(filePath,true); f.writeByte(239); f.writeByte(187); f.writeByte(191); f.writeString(text); f.close(); } }
Puts a UTF-8 Byte Order Mark (BOM) at the top of your text file to indicate that it contains UTF-8 encoded characters. Neko target only!
version #6809, modified 2009-08-19 09:49:04 by wildwinter