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' may 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 strings which follow should all be written with this flag. The other formats represent string formats that may not be written directly with the PB string functions. They are included only for completeness,

The Byte Order Mark is a commonly used method with which to indicate the encoding of 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() may be used detect a BOM within 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() ->