AEncoding
About
AEncoding is a small unit, which partly replaces LazUtils.LConvEncoding. It provides a few functions for converting strings from/to some encoding schemes:
function AEncodingConvertFromUTF8(const AInput: RawByteString; out AOutput: RawByteString;
AEnc: TSystemCodePage): boolean; inline;
function AEncodingConvertToUTF8(const AInput: RawByteString; out AOutput: RawByteString;
AEnc: TSystemCodePage): boolean; inline;
function AEncodingConvertFromTo(const AInput: RawByteString; out AOutput: RawByteString;
AEncInput, AEncOutput: TSystemCodePage): boolean;To use functions with "string" var, do this:
AEncoding....(RawByteString(S), ....);
Why "partly replaces"?
- It uses FPC 3.x SetCodePage, which requires OS support for many encodings, whereas LConvEncoding doesn't require OS support. For common encodings (CP1250...CP1258, CP437, CP866 etc) OS support should work, on Windows and Unix'es.
- FPC SetCodePage doesn't raise exceptions, while LConvEncoding can do it (when global variable is set in LConvEncoding unit).
It also gives few integer constants aeid_NNNN for common encodings.
- Author: Alexey Torgashin.
- License: MPL 2.0 or LGPL.
Download
GitHub: https://github.com/Alexey-T/AEncoding
From the Free Pascal wiki, page "AEncoding", as it stood on 2023-12-22 after a change by Alextpp, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.
Talk about this page
Nobody has opened a bench for this page yet. Sign in to open one.
