$Ov8.1.6-MacOS-10.13.6 :: Unicode UTF8 without BOM

jmv jmvoegeli at bluewin.ch
Tue Nov 20 05:04:10 EST 2018


Hi Listers,

I have to send a text file without BOM.

The text of this file is constructed in omnis with kCharacter/kSimplechar variables.

As it is character data I use Do $writecharacter

	Do vFileObj.$writecharacter(kUniTypeUTF8,pTexte,kFalse) Returns vOK

When I open the file in BBEditv12.5 it indicates that it is format UTF8 with BOM.
If I try to export this file on my web site (I'm using One.com <http://one.com/>) it does not open as One doesn't understand the BOM.

I understand that the BOM is not of much use with UTF8.

I tried to exclude it with :

	Do uniconv(kUniTypeNativeCharacters,pTexte,kUniTypeUTF8,vTexteUTF8ssBOM,kFalse,vErrTxt) Returns vError ;; Get rid of : 0xEF,0xBB,0xBF

I again save it with $writecharacter. But in BBEdit it shows as UTF with BOM.

So ...

I try to remove it myself with :

	Calculate vBinTxt as pTexte Calculate vFirst_Byte as 12 ;; On ignore 0 .. 11 
	Calculate vLast_Byte as binlength(vBinTxt) 
	Do bytemid(vBinTxt,vFirst_Byte,vLast_Byte) Returns vBinCut

But vBinCut miss the first three letters : no spur of any 0xEF,0xBB,0xBF at the beginning of the file.

IF in BBEdit I change the file to UTF8 without BOM, it charges well in One.com <http://one.com/>.

1) Does $writecharacter add the BOM without my knowledge ?

2) Is there somewhere a boolean to set to stop $writecharacter do do this ?

3) Or is there another mean to produce a text file UTF8 without the BOM ?

Thank you for your times.

Best regards,

Jean-Marc Voegeli


More information about the omnisdev-en mailing list