WriteStringFormat()

Syntax

WriteStringFormat(#File, Format)
Description
Writes a BOM (Byte Order Mark) at the current position in the file. It is a commonly used practice to identify the string encoding in a file.

'Format' can be one of the following:
  #PB_Ascii  : Writes no BOM at all (this is usually interpreted as an plain Ascii file.)
  #PB_UTF8   : UTF-8 BOM
  #PB_Unicode: UTF-16 (little endian) BOM

  #PB_UTF16BE: UTF-16 (big endian) BOM
  #PB_UTF32  : UTF-32 (little endian) BOM
  #PB_UTF32BE: UTF-32 (big endian) BOM
The #PB_Ascii, #PB_UTF8 and #PB_Unicode correspond to the flags supported by WriteString() and WriteStringN(). After placing such a BOM, the following strings should all be written with this flag. The other formats are represent string formats that cannot be directly written with PB string functions. They are included for completeness only.

The Byte Order Mark is a commonly used way to indicate the encoding for a textfile. It is usually placed at the beginning of the file. It is however not a standard, just a commonly used practice. So if no BOM is detected at the start of a file, it does not necessarily mean that it is a plain text file. It could also just mean that the program that created the file did not use this practice. ReadStringFormat() can be used detect a BOM in a file.

For more information, see this Wikipedia Article.
More information about using unicode in PureBasic program can also be found here.

Supported OS

All

<- WriteString() - File Index - WriteStringN() ->