Forum > Third party

EncConv: simplified code of LConvEncoding

(1/2) > >>

EncConv is simplified code of LConvEncoding from Lazarus.
it uses the same codepage tables.

- type of encoding ID is now enum
- removed using of FPC string convertion API, removed using of Unix iconv;
  so unit must work the same way on all platforms and FPC versions
- removed optional changing of CodePage for resulting string
- renamed most of functions, except simple functions like UTF8ToNNN, NNNToUTF8
- added EncConvErrorMode global var, which has 4 possible values
  (LConvEncoding global var had 2 values):
  raise exception, skip chars, replace chars with '?', return empty string
- removed parameter Encoded of functions

author: Alexey Torgashin

Looks like Pre FPC 3.0 code. It stuffs encodings into bytes without setting the encoding.

These are not conventions that are used anymore.

The code even fails in trunk.
Alex what version are you using?

Code was needed for ATSynEdit, which holds list of string (TFPGList<StringItem> which has string). so FPC 3 codepages were not needed for me.

I tested it on Linux in FPC 3.2 and 3.3 2019/04/26.

Updated FPC 3.3 from svn today. Again all works.
Demo must show "ok" for tests 1,2 and show "failed" for test3 (it must fail by design).


[0] Message Index

[#] Next page

Go to full version