Unicode use cases

This is an old revision of Unicode use cases, edited by Chronos at . The current revision is 56363.

category

Introduction

Currently, there's a lot of interest in the implementation of full Unicode support into fpc. This page is destined to describe situations where the developers face problems when dealing with Unicode characters/strings. In order to keep the information useful the description should be the more detailed possible and provide real code/examples when available.

Cases

Sqlite library requires filename to be encoded as UTF-8

The sqlite3 wrapper class provided by fpc (TSqlite3Dataset) stores the FileName property into an String type (ansistring) and uses it to open the database through a sqlite function (sqlite3_open) that expects an UTF-8 encoded string. This works fine as long the string is UTF-8 encoded or has only ASCII characters. The problem is that the encoding varies according to the situation. LCL and *nix rtl return UTF-8, Win32 rtl returns the current locale encoding. Some workarounds were tried:

So, in this case, AFAIK, there's no way to write a cross platform solution without using defines.

See Also