You are not logged in.

#1 2013-07-15 07:53:47

wangchong
Member
Registered: 2013-06-25
Posts: 76

[Solved]Archive manager cannot open Chinese-name files

Hi,
I use gnome together with its accessory archive manager in arch. However, my archive manager cannot open any Chinese-name files, nor can it compress one.
I used to have the same problem with libreoffice but later installed one package (sorry, I can't remember which one) and solved it. Is it necessary to install a package for archive manager to open foreign language files?
ps. I am not using Chinese environment. I just need to open Chinese files.

Last edited by wangchong (2013-07-17 01:48:46)

Offline

#2 2013-07-15 13:21:27

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: [Solved]Archive manager cannot open Chinese-name files

Is there an error message?

As a workaround, can the files be compressed / uncompressed at the command line?

Offline

#3 2013-07-16 06:31:26

wangchong
Member
Registered: 2013-06-25
Posts: 76

Re: [Solved]Archive manager cannot open Chinese-name files

1. No, there is no error message. It just doesn't open.
2. I cannot use command line, because Chinese-name files in terminal show themselves as ?????.odt. Is there any way to show Chinese in gnome-terminal?

Offline

#4 2013-07-16 06:40:07

HungGarTiger
Member
From: nz/auckland/
Registered: 2012-06-27
Posts: 187

Re: [Solved]Archive manager cannot open Chinese-name files

wangchong wrote:

1. No, there is no error message. It just doesn't open.
2. I cannot use command line, because Chinese-name files in terminal show themselves as ?????.odt. Is there any way to show Chinese in gnome-terminal?

I use fcitx with pinyin input and I can type and read Chinese language in my terminals just fine, I'm assuming you've set your locales to Chinese and have Chinese fonts installed?


"No sympathy for the devil. If you buy the ticket, take the ride."
- Hunter S. Thompson

Offline

#5 2013-07-16 07:13:35

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: [Solved]Archive manager cannot open Chinese-name files

FYI, .zip archives don't have good file name encoding support. For example, the filenames can be encoded in GBK for Chinese, and if your locale is xx_XX.UTF-8, the filenames you see via `unzip -l foo.zip` will be garbage, and if you `ls` the extracted files, they will look like ?????. You can try fuse-convmvfs to read these filenames correctly, or you can write a script to convert the filenames encoding for real, e.g.

mkdir foo/
unzip -d foo/ -x foo.zip
cd foo/
for i in *; do iconv -f GBK <<< "$i"; done
# if they look good, then they are indeed encoded in GBK, now let's rename them
for i in *; do mv -v "$i" "$(echo -n "$i" | iconv -f GBK)"; done

Edit: add -v to mv, so we can see more clearly.

EDIT: scratch all that crap. OMG I just find how great `convmv` is OMG.

Last edited by lolilolicon (2013-07-16 10:41:40)


This silver ladybug at line 28...

Offline

#6 2013-07-16 08:35:48

wangchong
Member
Registered: 2013-06-25
Posts: 76

Re: [Solved]Archive manager cannot open Chinese-name files

HungGarTiger wrote:
wangchong wrote:

1. No, there is no error message. It just doesn't open.
2. I cannot use command line, because Chinese-name files in terminal show themselves as ?????.odt. Is there any way to show Chinese in gnome-terminal?

I use fcitx with pinyin input and I can type and read Chinese language in my terminals just fine, I'm assuming you've set your locales to Chinese and have Chinese fonts installed?

well, I think I installed enough fonts. However, I didn't set my locale to Chinese. Is it really necessary to do so just to open Chinese-name files?

Offline

#7 2013-07-16 08:56:55

wangchong
Member
Registered: 2013-06-25
Posts: 76

Re: [Solved]Archive manager cannot open Chinese-name files

lolilolicon wrote:

FYI, .zip archives don't have good file name encoding support. For example, the filenames can be encoded in GBK for Chinese, and if your locale is xx_XX.UTF-8, the filenames you see via `unzip -l foo.zip` will be garbage, and if you `ls` the extracted files, they will look like ?????. You can try fuse-convmvfs to read these filenames correctly, or you can write a script to convert the filenames encoding for real, e.g.

mkdir foo/
unzip -d foo/ -x foo.zip
cd foo/
for i in *; do iconv -f GBK <<< "$i"; done
# if they look good, then they are indeed encoded in GBK, now let's rename them
for i in *; do mv -v "$i" "$(echo -n "$i" | iconv -f GBK)"; done

Edit: add -v to mv, so we can see more clearly.

In fact, using Archive Manager yields a different result from using unzip:
1.files uncompressed using Archive Manager will be like ??????.odt
2.files uncompressed using unzip will be like ?????.odt(invalid encoding)
Though both looking like ?????.odt in terminal, in nautilus using unzip will yield a file with an '(invalid encoding)' ending. Besides that, file uncompressed with unzip will be much messy than Archive Manager in nautilus. That is, it will not just be ????? and special characters will appear.

Offline

#8 2013-07-16 09:10:21

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: [Solved]Archive manager cannot open Chinese-name files

The Archive Manager/Nautilus, as is typical of GUI applications, probably is doing some magic there. Just stick to unzip (in the console), and convert filenames to UTF-8 using the technique I demonstrated earlier; then everything should be working just fine.

Edit:
Just figured I'd point out that the ways to display on terminal the invalid file names are very inconsistent between programs, e.g.

$ echo *
<?> # actually Unicode U+FFFD "replacement charater"
$ ls *
??
$ stat -c %n *  # %n file name
<?> # actually Unicode U+FFFD "replacement charater"
$ stat -c %N *  # %N quoted file name with dereference if symbolic link
‘\310\313’

...and Nautilus is just displaying it in a more user-friendly way by appending "(invalid encoding)", which obviously confuses the user more. %N is the best.
So probably Archive Manager is secretly converting the filename encoding, but failed.

Edit:
For the sake of completeness, if the stdout is not a terminal, all of `echo`, `ls` and `stat -c %n` will just output the raw bit stream of the filename without conversion for display on terminal.

Last edited by lolilolicon (2013-07-16 10:10:20)


This silver ladybug at line 28...

Offline

#9 2013-07-16 10:37:11

HungGarTiger
Member
From: nz/auckland/
Registered: 2012-06-27
Posts: 187

Re: [Solved]Archive manager cannot open Chinese-name files

wangchong wrote:
HungGarTiger wrote:
wangchong wrote:

1. No, there is no error message. It just doesn't open.
2. I cannot use command line, because Chinese-name files in terminal show themselves as ?????.odt. Is there any way to show Chinese in gnome-terminal?

I use fcitx with pinyin input and I can type and read Chinese language in my terminals just fine, I'm assuming you've set your locales to Chinese and have Chinese fonts installed?

well, I think I installed enough fonts. However, I didn't set my locale to Chinese. Is it really necessary to do so just to open Chinese-name files?

Well I've unchecked both en.US UFT8 and zn.CH UFT8, so I'm using both


"No sympathy for the devil. If you buy the ticket, take the ride."
- Hunter S. Thompson

Offline

#10 2013-07-16 10:45:21

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: [Solved]Archive manager cannot open Chinese-name files

Any UTF-8 locale will display the Chinese file names fine if they're encoded in UTF-8.
You can use convmv to convert the file names to UTF-8, or if for some reason you don't want to do so, you can temporarily set your environment locale to e.g. zh_CN.GBK, depending on the encoding of the file names.

Last edited by lolilolicon (2013-07-16 10:47:18)


This silver ladybug at line 28...

Offline

#11 2013-07-16 11:52:58

wangchong
Member
Registered: 2013-06-25
Posts: 76

Re: [Solved]Archive manager cannot open Chinese-name files

Thank you both. I uncommented zh-CN UTF-8 and zh-CN GBK and solved the problem.

Offline

#12 2013-07-16 23:08:48

HungGarTiger
Member
From: nz/auckland/
Registered: 2012-06-27
Posts: 187

Re: [Solved]Archive manager cannot open Chinese-name files

wangchong wrote:

Thank you both. I uncommented zh-CN UTF-8 and zh-CN GBK and solved the problem.

Good stuff.

Mark the title of the thread as [Solved] to help others in the future find help with similar problems smile


"No sympathy for the devil. If you buy the ticket, take the ride."
- Hunter S. Thompson

Offline

Board footer

Powered by FluxBB