Recent

Author Topic: TRegistry and UTF8  (Read 2649 times)

RolfW

  • New Member
  • *
  • Posts: 21
TRegistry and UTF8
« on: July 15, 2017, 04:48:54 pm »
Hi,
can anybody tell me why the TRegistry class still can't handle UTF8 strings?
The windows include file (winreg.inc) isn't that large. Should be possible to change it.
May be my view on the issue is not complete.
Thank you for any hint.
Rolf

Remy Lebeau

  • Hero Member
  • *****
  • Posts: 1314
    • Lebeau Software
Re: TRegistry and UTF8
« Reply #1 on: July 25, 2017, 01:13:27 am »
can anybody tell me why the TRegistry class still can't handle UTF8 strings?

Why should it?  The Registry itself does not support UTF-8 strings to begin with, only ANSI and UTF-16 strings.  If you want to store UTF-8 strings, you have to store them as raw binary data.  Otherwise, convert them to UTF-16 before storing, and convert them back to UTF-8 after retrieving.
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

Thaddy

  • Hero Member
  • *****
  • Posts: 14359
  • Sensorship about opinions does not belong here.
Re: TRegistry and UTF8
« Reply #2 on: July 25, 2017, 09:35:48 am »
It is fixed in trunk from this week.  Note FPC usually only guarantees to supports ANSI and UTF16 and NOT UTF8, but methods for handling UTF8 correctly are now added in the FCL for TRegistry on other platforms than Windows and the Windows version now uses UTF16 internally. FPC will probably never support UTF8 directly.
« Last Edit: July 25, 2017, 09:47:15 am by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

 

TinyPortal © 2005-2018