bentom Posted November 1, 2009 Posted November 1, 2009 Hi, a question regarding to Unicode. with the code FileOpen($PlaylistFile, 2 + 8 + 128) you create a file which is UTF8 coded but with the "byte order mark". Unfortunatelly the Software which reads the playlistfile needs the coding without "BOM". Does anybody know how to get a proper coding. Regards Alex
bentom Posted November 1, 2009 Author Posted November 1, 2009 Hi again, I found a texteditor that can convert the file into UTF8 w/o BOM. Unfortunatelly this has no scripting engine and has to be done manually. The only topic here in the forum I found was form 2007 and there was no support for UTF8 w/o BOM. I use the release 3.2.12.1 from June 2008. I would update if this is now supported. Anyone who has information on this? Regards, Alex
trancexx Posted November 2, 2009 Posted November 2, 2009 Hi, a question regarding to Unicode. with the code FileOpen($PlaylistFile, 2 + 8 + 128) you create a file which is UTF8 coded but with the "byte order mark". Unfortunatelly the Software which reads the playlistfile needs the coding without "BOM". Does anybody know how to get a proper coding. Regards Alex See if this helps: ;1. $sPlaylistFile = @DesktopDir & "\PlayListVer1.txt" $hFile = FileOpen($sPlaylistFile, 2 + 8 + 128) FileWrite($hFile, "Hey hey") FileClose($hFile) ;2. $sPlaylistFile = @DesktopDir & "\PlayListVer2.txt" $hFile = FileOpen($sPlaylistFile, 2 + 8 + 16) FileWrite($hFile, StringToBinary("Hey hey", 4)) FileClose($hFile) ♡♡♡ . eMyvnE
bentom Posted November 2, 2009 Author Posted November 2, 2009 Hi, thank you very much for your answer. Unfortunatelly not. The format I get is ANSI. But no UTF8 w/o BOM. I checked this with Notepad++ Any other ideas, or does Autoit not support this coding Regards, Alex
KaFu Posted November 2, 2009 Posted November 2, 2009 Check out the _WinAPI_CreateFile() example in the UDF Help-File, should be able to do what you want. MY research came up with that it's capable of writing unicode and BOM has to be create explicitly... but of course I could be wrong .... OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
trancexx Posted November 3, 2009 Posted November 3, 2009 Hi, thank you very much for your answer. Unfortunatelly not. The format I get is ANSI. But no UTF8 w/o BOM. I checked this with Notepad++ Any other ideas, or does Autoit not support this coding Regards, Alex You are jumping to conclusions. The only difference between those two is BO mark. See this butterfly from my sig. Run: ;1. $sPlaylistFile = @DesktopDir & "\PlayListVer1.txt" $hFile = FileOpen($sPlaylistFile, 2 + 8 + 128) FileWrite($hFile, ChrW(440) & ChrW(821) & ChrW(801) & ChrW(1244) & ChrW(821) & ChrW(808) & ChrW(772) & ChrW(439)) FileClose($hFile) ;2. $sPlaylistFile = @DesktopDir & "\PlayListVer2.txt" $hFile = FileOpen($sPlaylistFile, 2 + 8 + 16) FileWrite($hFile, StringToBinary(ChrW(440) & ChrW(821) & ChrW(801) & ChrW(1244) & ChrW(821) & ChrW(808) & ChrW(772) & ChrW(439), 4)) FileClose($hFile) ♡♡♡ . eMyvnE
PsaltyDS Posted November 3, 2009 Posted November 3, 2009 Hi, thank you very much for your answer. Unfortunatelly not. The format I get is ANSI. But no UTF8 w/o BOM. I checked this with Notepad++ There is already another example from trancexx, but I was wondering why you used Notepad++ to check the format. I ran this mod to trancexx's demo to verify it for my own education: ;1. $sPlaylistFile = @DesktopDir & "\PlayListVer1.txt" $hFile = FileOpen($sPlaylistFile, 2 + 8 + 128) FileWrite($hFile, "Hey hey") FileClose($hFile) $hFile = FileOpen($sPlaylistFile, 16) $bData = FileRead($hFile) FileClose($hFile) ConsoleWrite("$bData = " & $bData & @LF) ;2. $sPlaylistFile = @DesktopDir & "\PlayListVer2.txt" $hFile = FileOpen($sPlaylistFile, 2 + 8 + 16) FileWrite($hFile, StringToBinary("Hey hey", 4)) FileClose($hFile) $hFile = FileOpen($sPlaylistFile, 16) $bData = FileRead($hFile) FileClose($hFile) ConsoleWrite("$bData = " & $bData & @LF) The output is: >Running:(3.3.0.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Program Files\AutoIt3\Scripts\Test1.au3" $bData = 0xEFBBBF48657920686579 $bData = 0x48657920686579 Compare the BOM here. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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