Page 1 of 1
IDE - Save source code(*.pb?) with BOM if UTF-8 checked.
Posted: Fri Nov 21, 2014 8:14 pm
by skywalk
Fred solved a weird Unicode string bug I had.
This snippet works fine in a standalone UTF-8 source file compiled with Unicode.
But within a larger app(many IncludeFiles) the 1st char of each word was dropped. Fred told me to check all my source files had the UTF-8 BOM and some did not.
Code: Select all
Define$ s$ = "ŠTEPÁNEK ŽIGIC lives."
Debug s$ ; Without UTF-8 BOM, prints " TEPÁNEK IGIC lives."
It would have spared me debug time if the IDE saved my source files(.pb? only) as UTF-8 + BOM when my preferences select UTF-8 sources.
Also, I would not have to open them in an external editor like NotePad++ just to "Convert to UTF-8".
Re: IDE - Save source code(*.pb?) with BOM if UTF-8 checked.
Posted: Sat Nov 22, 2014 10:02 am
by Little John
skywalk wrote:It would have spared me debug time if the IDE saved my source files(.pb? only) as UTF-8 + BOM when my preferences select UTF-8 sources.
Are you saying that on your system the PB IDE (always/sometimes?) saves UTF-8 source files
without BOM?
If my memory serves me right, my UTF-8 source files always have been saved by the IDE
with BOM.
Re: IDE - Save source code(*.pb?) with BOM if UTF-8 checked.
Posted: Sat Nov 22, 2014 5:01 pm
by skywalk
Yes, that makes sense the IDE would store the BOM but it was definitely not the case for many of my pb includes. I don't know the IDE's save logic since the appended IDE options do not have a switch for UTF-8? Maybe they were originally created with Plain text? However, once the user selects UTF-8, I think the IDE should save the BOM.
Code: Select all
; IDE Options = PureBasic 5.31 (Windows - x86)
; CursorPosition = 527
; FirstLine = 494
; Folding = ---
; EnableUnicode
; UseIcon = img\my.ico
; Executable = my.exe
; CurrentDirectory = C:\myprj\
; CompileSourceDirectory
; IncludeVersionInfo
; VersionField0 = %yy,%mm,%dd,0
; VersionField1 = %yy,%mm,%dd,0
; VersionField2 = myco
; VersionField3 = myapp
; VersionField4 = %yy.%mm.%dd
; VersionField5 = %yy.%mm.%dd
; VersionField6 = myapp
; VersionField7 = myapp
; VersionField8 = myapp.exe
; VersionField13 = me@myco.com
Re: IDE - Save source code(*.pb?) with BOM if UTF-8 checked.
Posted: Sat Nov 22, 2014 5:44 pm
by Shield
Just as a side note here, a BOM should not be used for UTF-8 files according to the standard specs.
Unicode Specs wrote:
Use of a BOM is neither required nor recommended for UTF-8