Why would mb_str(wxConvISO8859_1) fail for wxFileDialog.GetPath?

29 views
Skip to first unread message

ardi

unread,
May 27, 2012, 11:36:05 AM5/27/12
to wx-users
Hi,

This is something strange that I don't understand. I'm successfully
using wxConvISO8859_1 for converting ISO-8859-1 char* strings from/to
wxString (unicode build).

However, if I get a wxString with the GetPath() method of
wxFileDialog, and I convert it to a ISO-8859-1 char* string with
mb_str(wxConvISO8859_1), it fails.

Well, not always: If the path is made of just ASCII characters, it
works. But if the path has any accented char (supported in
ISO-8859-1), it returns a null string. I'm doing this with OSX-Cocoa,
2.9.3.

What could be happening? Any ideas? As I said this same conversion
works fine in all parts of my code. It only fails with
wxFileDialog.GetPath().

TIA

ardi

Vadim Zeitlin

unread,
May 27, 2012, 11:48:26 AM5/27/12
to wx-u...@googlegroups.com
On Sun, 27 May 2012 08:36:05 -0700 (PDT) ardi wrote:

a> Well, not always: If the path is made of just ASCII characters, it
a> works. But if the path has any accented char (supported in
a> ISO-8859-1), it returns a null string. I'm doing this with OSX-Cocoa,
a> 2.9.3.
a>
a> What could be happening? Any ideas? As I said this same conversion
a> works fine in all parts of my code. It only fails with
a> wxFileDialog.GetPath().

I think it should be fixed by this patch:

http://trac.wxwidgets.org/attachment/ticket/13504/normalize.patch

Please test it and leave a note in Trac if it works (or doesn't) for you.

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/

ardi

unread,
May 27, 2012, 12:57:57 PM5/27/12
to wx-users


On May 27, 5:48 pm, Vadim Zeitlin <va...@wxwidgets.org> wrote:
> On Sun, 27 May 2012 08:36:05 -0700 (PDT) ardi wrote:
>
> a> Well, not always: If the path is made of just ASCII characters, it
> a> works. But if the path has any accented char (supported in
> a> ISO-8859-1), it returns a null string. I'm doing this with OSX-Cocoa,
> a> 2.9.3.
> a>
> a> What could be happening? Any ideas? As I said this same conversion
> a> works fine in all parts of my code. It only fails with
> a> wxFileDialog.GetPath().
>
>  I think it should be fixed by this patch:
>
>    http://trac.wxwidgets.org/attachment/ticket/13504/normalize.patch
>
> Please test it and leave a note in Trac if it works (or doesn't) for you.

Thank you, thank you, thank you!! Yes, this fixed it!

I left a note at the Trac ticket.

ardi

Reply all
Reply to author
Forward
0 new messages