Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

UTF-8/Unicode characters in a TMemo control

1,842 views
Skip to first unread message

Ian Davidson

unread,
Nov 2, 2005, 9:54:41 AM11/2/05
to

I have an application where the user has to write non-English test into a TMemo control. For example, in Turkey, they have to be able to type the "ı" (like i but without a dot on top).

When I tried to copy and paste that into the TMemo field, it showed as a Question Mark.

Is there a way to allow such characters to be entered into a TMemo field.

Ian

Adem

unread,
Nov 2, 2005, 11:20:48 AM11/2/05
to
Ian Davidson wrote:

>Is there a way to allow such characters to be entered into a
>TMemo field.

TNT controls

http://www.tntware.com/delphicontrols/unicode/

Once you install TNT stuff, simply edit your DFM and PAS
files so that the units are TNTxxxx.

i.e.

TMemo --> TTntMemo

HTH,

Cheers,
Adem

Peter Below (TeamB)

unread,
Nov 2, 2005, 2:31:33 PM11/2/05
to
In article <4368e141$1...@newsgroups.borland.com>, Ian Davidson wrote:
> I have an application where the user has to write non-English test
> into a TMemo control. For example, in Turkey, they have to be able
> to type the "ı" (like i but without a dot on top).
>
> When I tried to copy and paste that into the TMemo field, it showed
> as a Question Mark.

What you see in a standard TMemo depends on your current locale and the
codepage it uses. The control is not Unicode-aware (unless you use it
in a .NET application), so it uses multi-byte character sets, depending
on the system locale and the font you selected.

You could try to set the memo.font.Charset to TURKISH_CHARSET, that may
work for this particular case. But using Unicode-enabled controls as Adem
advised is the better solution if you need to support basically any locale
without knowing at compile time which that may be.

--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be


Ian Davidson

unread,
Nov 7, 2005, 6:17:50 AM11/7/05
to

The data I am trying to display relates to a Web page.

If at runtime I know
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> (or 8859-9)
can I use that to set the memo.font.charset?

"Peter Below (TeamB)" <10011...@compuXXserve.com> wrote:

>
>What you see in a standard TMemo depends on your current locale and the
>codepage it uses.

>

Peter Below (TeamB)

unread,
Nov 7, 2005, 2:20:12 PM11/7/05
to
In article <436f45ee$1...@newsgroups.borland.com>, Ian Davidson wrote:
> The data I am trying to display relates to a Web page.
>
> If at runtime I know
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> (or 8859-9)
> can I use that to set the memo.font.charset?

Yes, if you can figure out which of the available charset values matches
the encoding best. Unfortunately the codepages used by Windows are not always direct
equivalents of ISO standard encodings. You need to find the specs for the
charsets in question and check how well they match. The equivalent for iso 8859-9 is
the Windows codepage 1254, for example, iso 8859-1 (latin1) would be codepage 1252.

The Internet development SDK (basically the IE API) seems to contain quite a bit of
functionality useful for the task of figuring out how to display text from the
internet in a Windows font. Search the MSDN library for MLang...

0 new messages