Recent

Author Topic: EncConv: simplified code of LConvEncoding  (Read 2231 times)

AlexTP

  • Hero Member
  • *****
  • Posts: 2386
    • UVviewsoft
EncConv: simplified code of LConvEncoding
« on: September 16, 2019, 12:39:22 pm »
EncConv is simplified code of LConvEncoding from Lazarus.
it uses the same codepage tables.

changes:
- 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
https://github.com/Alexey-T/EncConv

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: EncConv: simplified code of LConvEncoding
« Reply #1 on: September 16, 2019, 01:05:22 pm »
Looks like Pre FPC 3.0 code. It stuffs encodings into bytes without setting the encoding.

These are not conventions that are used anymore.

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: EncConv: simplified code of LConvEncoding
« Reply #2 on: September 16, 2019, 01:13:08 pm »
The code even fails in trunk.
Alex what version are you using?
Specialize a type, not a var.

AlexTP

  • Hero Member
  • *****
  • Posts: 2386
    • UVviewsoft
Re: EncConv: simplified code of LConvEncoding
« Reply #3 on: September 16, 2019, 09:21:49 pm »
@marcov
Code was needed for ATSynEdit, which holds list of string (TFPGList<StringItem> which has string). so FPC 3 codepages were not needed for me.

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

AlexTP

  • Hero Member
  • *****
  • Posts: 2386
    • UVviewsoft
Re: EncConv: simplified code of LConvEncoding
« Reply #4 on: September 16, 2019, 09:27:49 pm »
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).

AlexTP

  • Hero Member
  • *****
  • Posts: 2386
    • UVviewsoft
Re: EncConv: simplified code of LConvEncoding
« Reply #5 on: June 18, 2022, 09:16:13 pm »
Updated the component:

+ add: support encoding iso-8859-7
+ add: support encoding iso-8859-10
+ add: support encoding iso-8859-13
+ add: support encoding iso-8859-5
+ add: support encoding iso-8859-14
+ add: support encoding iso-8859-16

I also send the patches of these encodings to LConvEncoding, but for those ppl who don't use Lazarus trunk, it's not possible to use these last changes.
Last 3 encodings ( -10, -7 and -13 ) are not merged to Laz.
So use EncConv.
« Last Edit: June 19, 2022, 10:08:54 am by AlexTP »

AlexTP

  • Hero Member
  • *****
  • Posts: 2386
    • UVviewsoft
Re: EncConv: simplified code of LConvEncoding
« Reply #6 on: June 19, 2022, 09:50:52 am »
+ add: support encoding iso-8859-3.

Anybody needs more ISO-8859 encodings?
Any other encodings (1-byte codepages)?

 

TinyPortal © 2005-2018