Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#11743 closed defect (fixed)

Encoding problem with wxDirPickerCtrl::GetPath

Reported by: lyc1 Owned by:
Priority: normal Milestone:
Component: wxGTK Version: 2.8.10
Keywords: Cc: dev@…
Blocked By: Blocking:
Patch: no

Description

On Ubuntu 9.10, wxWidget 2.8.10 unicode, when selecting a folder with accents, wxDirPickerCtrl::GetPath returns a badly encoded string
Sample :

  • I select /home/user/Vidéos/
  • GetPath returns /home/user/Vidéos/

Attachments (1)

filepicker.patch download (397 bytes) - added by ZenJu 4 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 4 years ago by lyc1

  • Cc dev@… added

comment:2 Changed 4 years ago by vadz

  • Status changed from new to confirmed

I can see this problem (even with 2.9) but only in "C" locale (and not e.g. "fr_FR.UTF-8" one). I'm going to fix it anyhow but if you don't use "C" or some other non-UTF-8 locale this must be a different problem which I'm unable to reproduce here...

comment:3 Changed 4 years ago by VZ

  • Resolution set to fixed
  • Status changed from confirmed to closed

(In [63549]) Always use UTF-8 for GTK+ strings.

Strings returned and accepted by GTK+ functions always use UTF-8 independently
of the current locale and of the file name encoding we use. So use UTF-8
instead of wxConvFileName everywhere where we deal with GTK+ directly.

Closes #11743.

comment:4 Changed 4 years ago by ZenJu

  • Resolution fixed deleted
  • Status changed from closed to reopened

Hi,

the problem in this case is a false conversion from UTF-8 to wide character done by the filepicker control (See version v2.8.10 code line):

filePicker.h
void UpdatePath(const char *gtkpath)
{ m_path = wxString::FromAscii(gtkpath); }

This should read "wxString::FromUTF8(gtkpath); }" instead. Maybe it may be generally a good idea to search the wGTK codebase for "FromAscii" and check for potential conversion problems.

Regards, ZenJu

comment:5 Changed 4 years ago by vadz

  • Resolution set to port to stable
  • Status changed from reopened to portneeded

This is indeed what was fixed in r63549. It should indeed be backported to 2.8, if you can make a tested patch with the necessary changes, it would be great.

Changed 4 years ago by ZenJu

comment:6 Changed 4 years ago by lyc1

I confirmed this patch fixes the problem on WxWidgets 2.8.10 on Ubuntu.

I would be great to include it in next milestone (2.8.11).

Thanks

comment:7 Changed 4 years ago by VZ

  • Resolution changed from port to stable to fixed
  • Status changed from portneeded to closed

(In [63600]) Always use UTF-8 for GTK+ strings [backport of r63549 from trunk].

Strings returned and accepted by GTK+ functions always use UTF-8 independently
of the current locale and of the file name encoding we use. So use UTF-8
instead of wxConvFileName everywhere where we deal with GTK+ directly.

Closes #11743.

comment:8 Changed 4 years ago by VZ

(In [63601]) Fix another incorrect file name conversion in wxGTK.

GTK file paths are in UTF-8 and not ASCII.

Really closes #11743.

Note: See TracTickets for help on using tickets.