Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2015-12

simple conversion of unicode chars

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

ulrich

Hi,

I need the simplest possible transfer of one unicode character (numeric string or integer) to the default windows code page (CP1250).

Thanks

Roman

Bart
to ulrich
ulrich wrote
I need the simplest possible transfer of one unicode character (numeric string or integer) to the default windows code page (CP1250).

You mean from codepoint (U+xxxx) to single byte CP1250?

In unit LazUtf8  (in LazUtils from Lazarus):
function UnicodeToUTF8(CodePoint: cardinal): string;
In unit lconvencoding (in LazUtils from Lazarus):
function UTF8ToCP1250(const s: string; SetTargetCodePage: boolean =
false): RawByteString; // central europe

The LazUtils package can be used in console programs as well (it does not depend on LCL or widgetset).
In lazarus, start a new project (simple program) then use the projectIspectro to add a dependency on LazUtils package (this will add the right paths to the project info file).

That should do the trick.

Bart