filename encoding

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
fengyunsddl
In need of some credit
In need of some credit
Posts: 3
Joined: Sat May 05, 2018 7:23 am

filename encoding

Post by fengyunsddl »

Hello, I have a question when using filedialog to select a file from filesystem. The LANG environment is zh_CN.GB18030. The path has chinese character. The file dialog seems ok to display filename. But when I chose the file. I can not get the file path. It return empty string.

I read the source filectrl.cpp dirdlg.cpp etc.

wxString wxGtkFileChooser::GetPath() const
{
wxGtkString str( gtk_file_chooser_get_filename( m_widget ) );

wxString string;

if (str)
string = wxString::FromUTF8(str);
return string;
}

I guess the problem is "string = wxString::FromUTF8(str);". Because the encoding in my linux system is zh_CN.GB18030. But the wxWidgets almost read from UTF8.

Is it a bug?

Thanks!
User avatar
doublemax
Moderator
Moderator
Posts: 19117
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: filename encoding

Post by doublemax »

I can't help with the question as i don't work under Linux. But for others that might be able to help:
Linux distro?
wxWidgets version?
wxWidgets built for GTK2 or GTK3?
GTK version?
Use the source, Luke!
fengyunsddl
In need of some credit
In need of some credit
Posts: 3
Joined: Sat May 05, 2018 7:23 am

Re: filename encoding

Post by fengyunsddl »

Thank you. It is my system environment below.

[d5000@localhost ~]$ uname -a
Linux localhost.localdomain 2.6.18-411.ky3.skl #1 SMP Tue Sep 13 08:57:57 CST 2016 x86_64 x86_64 x86_64 GNU/Linux
[d5000@localhost ~]$
[d5000@localhost ~]$ wx-config --version
3.0.4
[d5000@localhost ~]$
[d5000@localhost ~]$ pkg-config --list-all |grep gtk
gtk+-2.0 GTK+ - GIMP Tool Kit (x11 target)
gtk-doc gtk-doc - API documentation generator
gtk+-x11-2.0 GTK+ - GIMP Tool Kit (x11 target)
gtk+-unix-print-2.0 GTK+ - GIMP Tool Kit Unix print support
libgnomeprint-2.2 libgnomeprint-2.2 - libgnomeprint - Printing library for gtk+ based applications
libgnomeprintui-2.2 libgnomeprintui-2.2 - libgnomeprint - Printing library for gtk+ based applications
pygtk-2.0 PyGTK - Python bindings for GTK+ and related libraries
gtk-engines-2 gtk-engines-2 - GTK+ Theme Engines
[d5000@localhost ~]$
fengyunsddl
In need of some credit
In need of some credit
Posts: 3
Joined: Sat May 05, 2018 7:23 am

Re: filename encoding

Post by fengyunsddl »

[d5000@localhost ~]$ locale
LANG=zh_CN.GB18030
LC_CTYPE="zh_CN.GB18030"
LC_NUMERIC="zh_CN.GB18030"
LC_TIME="zh_CN.GB18030"
LC_COLLATE="zh_CN.GB18030"
LC_MONETARY="zh_CN.GB18030"
LC_MESSAGES="zh_CN.GB18030"
LC_PAPER="zh_CN.GB18030"
LC_NAME="zh_CN.GB18030"
LC_ADDRESS="zh_CN.GB18030"
LC_TELEPHONE="zh_CN.GB18030"
LC_MEASUREMENT="zh_CN.GB18030"
LC_IDENTIFICATION="zh_CN.GB18030"
LC_ALL=

wxWidgets complied by:

cd build
../configure --enable-xrc --enable-unicode
make
make install
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7461
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: filename encoding

Post by ONEEYEMAN »

Hi,
Can you compile and run the dialogs sample and see if it behaves the same way?

Thank you.
Post Reply