realbasic-nug
[Top] [All Lists]

Re: Listbox accentuated chars corruption

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Listbox accentuated chars corruption
From: "Joseph J. Strout" <joe at realsoftware dot com>
Date: Thu, 22 Aug 2002 08:30:09 -0700
At 12:20 PM -0300 8/22/02, Leonardo L.Vasconcellos wrote:

I have a listbox that accept file drops. I drop a file in it and the
filename is displayed in a listbox row. Then I display the file name
in a message box. Everything goes fine except for files with
accentuation. Filenames with accentuation are displayed with a Å
instead of the right char. But if you put it in a editfield it runs
perfectly. Is there a way to solve this or it's a bug.

It's not a bug, but a limitation of REALbasic 4.5 (which I assume
you're using).  File names are returned in UTF-8 encoding.
EditFields (in Carbon) are encoding-savvy and know what to do with
this, as are listboxes and StaticTexts and so on.  But the MsgBox
function is not; it assumes the string you give it is in the system
encoding.  The solution is to satisfy its assumption: convert the
file name string from UTF-8 to the system encoding.

Or, perhaps a better solution is to not use MsgBox for messages the
user will see; it's really only intended for quick hacks.  Make your
own dialog that displays a message using a StaticText, and it'll work
fine.

Cheers,
- Joe

--
,------------------------------------------------------------------.
|    Joseph J. Strout           REAL Software, Inc.                |
|    joe at realsoftware dot com       http://www.realsoftware.com        |
`------------------------------------------------------------------'


<Prev in Thread] Current Thread [Next in Thread>