I looked at the pdf reference document (v1.3) - it's an open standard.
Section 3.8.1 deals with Text Strings:
Quote:
Certain strings contain information that is intended to be human-readable, such
as text annotations, bookmark names, article names, document information, and
so forth. Such strings are referred to as text strings. Text strings are encoded in
either PDFDocEncoding or Unicode character encoding. PDFDocEncoding is a
superset of the ISO Latin 1 encoding and is documented in Appendix D. Unicode
is described in the document The Unicode Standard (see the Bibliography).
For text strings encoded in Unicode, the first two bytes must be 254 followed by
255, representing the Unicode byte order marker, U+FEFF. (This sequence con-
flicts with the PDFDocEncoding character sequence thorn ydieresis, which is unlikely to be a meaningful beginning of a word or phrase.) The remainder of the
string consists of Unicode character codes, according to the UTF-16 encoding
specified in the Unicode standard, version 2.0. Commonly used Unicode values
are represented as 2 bytes per character, with the high-order byte appearing first
in the string.
Anywhere in a Unicode text string, an escape sequence may appear to indicate the
language in which subsequent text is written; this is useful when the language
cannot be determined from the character codes used in the text itself. The escape
sequence consists of the following elements, in order:
1. The Unicode value U+001B (that is, the byte sequence 0 followed by 27)
2. A 2-character ISO 639 language code—for example, EN for English or JA for
Japanese
3. (Optional) A 2-character ISO 3166 country code—for example, US for the
United States or JP for Japan
4. The Unicode value U+001B
The complete list of codes defined by ISO 639 and ISO 3166 can be obtained
from the International Organization for Standardization (see the Bibliography).
It looks like you put $fe $ff at the beginning of the string then carry on outputting the unicode string in hilo order. The spec version of the document should be at least 1.3