darkUnicode codec for Delphi

Posted by on in Programming

Another library to drop out of my Dark Glass development project today is my unicode codec (now named darkUnicode).

This simple class can be used to encode and decode unicode code-points by hand (independent of RTL functions to do the same), and I’ve used it previously to create my own unicode text buffer and stream support.  It can also  be used to determine the unicode format of a text file, by calling the DecodeBOM() method in the appropriate order.

Tip: Depending on Little / Big Endian, the BOM for UTF-32 formats may match BOM for a UTF-16 format when only considering the first 16-bits, so test for 32-bit BOM first.

I hope someone finds this library useful.

Thanks for Reading!


Check out more tips and tricks in this development video: