ADC Home > Reference Library > Technical Q&As > Cocoa > Data Management >

BOM characters in 'utxt' clipboard flavor


Q: As of Mac OS X 10.2, Cocoa apps seem to put a spurious character at the beginning of scrap data. What's going on here?

A: Cocoa has always put a Byte Order Mark (BOM) character (for indicating endianness) in Unicode text on the clipboard, and as of 10.2, it does so for the 'utxt' scrap flavor as well, as documented by Inside Mac:Text Encoding Conversion Manager. Code that reads the 'utxt' data should look for and strip the BOM character (instead of simply displaying it), and if it is 0xFFFE, it should byte swap the data before using it. Note that if the BOM character is not present, big-endian order is assumed. Also note that the inclusion of the BOM character for the 'utxt' scrap flavor was disabled (for compatability reasons) in 10.2.3, but it will be reintroduced at a later date.


[Jan 20 2003]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.