lsakizada Posted August 14, 2007 Posted August 14, 2007 I have the script bellow that convert Unicode to UTF-8 file. I need the UTF-8 file to be save with no BOM can you help please? if $CmdLine[0] <> 2 then MsgBox(0,0,"Uses: U2UTF8 'Path to Source Unicode File' 'Path to Destination UTF-8 File' ") exit EndIf Dim $UnicodeFile = $CmdLine[1] Dim $UTF8FILE = $CmdLine[2] $File1 = FileOpen($UnicodeFile, 0); $Unicode = FileRead($File1, FileGetSize($UnicodeFile)) FileClose($File1) $file = FileOpen($UTF8FILE, 128+2) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileWrite($file, $Unicode) FileClose ($file) Be Green Now or Never (BGNN)!
ChrisL Posted August 14, 2007 Posted August 14, 2007 Any use?http://www.autoitscript.com/forum/index.ph...hl=unicode++bomIsBinaryString() doesn't exist anymore change it to isBinary() instead [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
leuce Posted August 27, 2007 Posted August 27, 2007 I have the script bellow that convert Unicode to UTF-8 file. I need the UTF-8 file to be save with no BOM. Amazing... I need the same thing. Here is my script: $i = $CmdLine[1] $j1 = FileOpen ($i, 128) $k = FileRead ($j1) $l = StringReplace ($k, @CRLF, @LF) FileClose ($j1) $j2 = FileOpen ($i, 130) FileWrite ($j2, $l) FileClose ($j2) My script is for changing Windows line endings into Unix line endings, and it works except for two things: 1. It adds a BOM 2. It doesn't save as UTF8 The script works if you compile it and then drag and drop the file onto the EXE file (the result replaces the original file). Anyone found a simple way to remove the BOM yet? Is there a macro code for the BOM so that one can simply remove it?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now