Page 1 of 1

Converting unicode code [ANSI format] to unicode glyphs

Posted: Tue Sep 04, 2018 5:40 am
by Nostradamus
Hello Sergey,
I was wondering how to use Delphi [for use in Delphi5 with TNT unicode components and MS Access 2003 database]

to convert 13000 into ð“€€. and vice versa.



This way I can use ANSI format codepoint text to store Egyptian Hieroglyphs inside a MS Access 2003 Database-Table then use the encoder/decoder to
display the Egyptian Hieroglyphs on screen.

Any help is appreciated.

Richard

Re: Converting unicode code [ANSI format] to unicode glyphs

Posted: Tue Sep 04, 2018 5:41 am
by Nostradamus
See link below

https://r12a.github.io/uniview/#title

use the section

SHOW BLOCK >>> to select Egyptian Hieroglyphs.

Re: Converting unicode code [ANSI format] to unicode glyphs

Posted: Tue Sep 04, 2018 5:27 pm
by Sergey Tkachenko
If the question is how to display these characters in TRichView...

First, you need a new version of TRichView, where UTF-16 is supported completely.

To insert such codes in TRichView, they need to be converted to UTF16.
TRichView includes a function for this in RVUni unit: RVU_UnicodeCharToUTF16:

Code: Select all

RichViewEdit1.InsertText(RVU_UnicodeCharToUTF16($13000));
RVU_UnicodeCharToUTF16 converts UTF-32 code to up to two WideChars (i.e. to UTF16)
There is also a reverse function, RVU_UTF16ToUnicodeChar, it converts a surrogate pair of WideChars to UTF-32

Also, in TRichViewEdit, you can type 13000 directly in the editor and press Alt+X to convert it to the character.

Also, new version RichViewActions support all Unicode characters in the "Insert Symbol" dialog:
egiptian-hieroglyphs.png
egiptian-hieroglyphs.png (69.17 KiB) Viewed 19855 times

Re: Converting unicode code [ANSI format] to unicode glyphs

Posted: Wed Sep 05, 2018 5:12 am
by Nostradamus
Will this code patch work with TDBEdit, TEdit or TText ?

Will it work with Delphi 5 Enterprise , MS Access 2003 Windows XP ?

With regard to
RVU_UnicodeCharToUTF16 converts UTF-32 code to up to two WideChars (i.e. to UTF16)
There is also a reverse function, RVU_UTF16ToUnicodeChar, it converts a surrogate pair of WideChars to UTF-32


Will this work with Delphi 5 on Windows XP?

I have another computer with Windows 7 and Delphi 2010 on that one?

Re: Converting unicode code [ANSI format] to unicode glyphs

Posted: Wed Sep 05, 2018 5:13 am
by Nostradamus
I want to store these numbers 13000 13001 13002 in a DBMemo in this format and display them on screen as Script

Re: Converting unicode code [ANSI format] to unicode glyphs

Posted: Wed Sep 05, 2018 9:04 am
by Sergey Tkachenko
RVU_UnicodeCharToUTF16 and RVU_UTF16ToUnicodeChar do a very simple math calculation (using information which you can find in Wikipedia), they are platform-independent and Delphi-version-independent.
You can use these functions even in applications that do not use TRichView: copy them to another unit, replacing TRVUnicodeString to UnicodeString or WideString, and TRVUnicodeChar to WideChar.

The result of RVU_UnicodeCharToUTF16 is WideString, you can insert it in TEdit in Delphi5+TNT or Delphi2010.
I believe it should work, at least if you assign a font that has Egyptian glyphs (in TRichView, a font substitution works, so if the font does not have some glyphs, glyphs from another font are used; in standard controls, font substitution may sometime work and sometimes not).
But I suggest you to test.