company logo

MP3Frame :: encoding - Text encoding

(copied from http://id3.org/id3v2.4.0-structure)

If nothing else is said, strings, including numeric strings and URLs, are represented as ISO-8859-1 characters in the range 0x20 - 0xFF. Such strings are represented in frame descriptions as <text string>, or <full text string> if newlines are allowed. If nothing else is said newline character is forbidden. In ISO-8859-1 a newline is represented, when allowed, with 0x0A only.

Frames that allow different types of text encoding contains a text encoding description byte. Possible encodings:

  • 0x00 - ISO-8859-1 [ISO-8859-1]. Terminated with 0x00.
  • 0x01 - UTF-16 [UTF-16] encoded Unicode [UNICODE] with BOM. All strings in the same frame SHALL have the same byteorder. Terminated with 0x0000.
  • 0x02 - UTF-16BE [UTF-16] encoded Unicode [UNICODE] without BOM. Terminated with 0x0000.
  • 0x03 - UTF-8 [UTF-8] encoded Unicode [UNICODE]. Terminated with 0x00.

Text encoding character is part of the text, i.e. it is included in text length. When text begins with any other character.

Return value:  Text encoding ( int32  )

Text encoding supports 4 values:

  • 0 - ISO-8859-1 [Latin1].
  • 1 - UTF-16 with BOM
  • 2 - UTF-16 without BOM
  • 3 - UTF-8

Other values are considered as invalid

Implementation overview

Implementation details

  1. Get current frame text encoding
    int32 MP3Frame  :: encoding (  )

    The function throws an exception when MP3 frame is invalid.

  2. to list
  3. Set current frame text encoding
    int32 MP3Frame  :: encoding ( int32 iEncoding )

    Text encoding value passed in iEncoding must be less than 4 and greater than or equal to 0.

    The function throws an exception when MP3 frame is invalid or an invalid value has been passed.

    • iEncoding - Text encoding

      Text encoding supports 4 values:

      • 0 - ISO-8859-1 [Latin1].
      • 1 - UTF-16 with BOM
      • 2 - UTF-16 without BOM
      • 3 - UTF-8

      Other values are considered as invalid

  4. to list