Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm struggling to have 7za.exe create an archive including non latin characters. The encoding is utf-8, characters are cyrillic. I have a folder with the 4 files:

7za.exe privet.txt Кириллица.txt test.py

where the content of test.py is the following:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

SOURCE_FILE = "Кириллица.txt"
DEST_ARCHIVE = "Кириллица.7z"

import subprocess

subprocess.call('7za a -bd -y privet.7z privet.txt', shell=True)

cmd_str = '7za a -bd -y %s %s' % (DEST_ARCHIVE, SOURCE_FILE)
subprocess.call(cmd_str, shell=True)

While I can create privet.7z from privet.txt, I cannot create Кириллица.7z from Кириллица.txt (an empty archive named Кириллица.7z is instead generated).

The output from 7za.exe is:

C:\BEPPE\STAMPARE\TEST_7za_cyrillic>python test.py
7-Zip (A) 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
Scanning
Creating archive privet.7z
Everything is Ok
7-Zip (A) 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
Scanning
ÐsиÑ_иллиÑ┼а.txt:  WARNING: Impossibile trovare il file specificato.
Creating archive ÐsиÑ_иллиÑ┼а.7z
WARNINGS for files:
ÐsиÑ_иллиÑ┼а.txt : Impossibile trovare il file specificato.
----------------
WARNING: Cannot find 1 file

Can anybody help me with this? I also tried from a batch script test.bat with the following content:

7za.exe a -bd -y privet.7z privet.txt
7za.exe a -bd -y Кириллица.7z Кириллица.txt

but the result was the same.

share|improve this question

2 Answers 2

Handling UTF-8 (Unicode, really) is not easy, it wouldn't surprise me in the least that handling of UTF-8 (or even non-ASCII) filenames just hasn't been done. The messed up name of the file created hints at serious problems in the handling of filenames (a compress/uncompress program is at the mercy of possibly malicious contents). I'd handle that as toxic materials, looking for a more robust compressing solution.

share|improve this answer
    
I also would like to avoid using this method but at the moment I really need to find a way because I have several documents compressed and password protected using this tool which on linux works great but on windows has this terrible limitation –  giuspen Feb 5 '13 at 14:18

This works for me:

  1. Download Notepad++ (even the <900KB minimalist package will do)

  2. Go to the Settings / Preferences / New Document tab and set the default Encoding to UTF-8 without BOM:

    1

  3. Open a new document and type the following command in it:

    cmd /u /c "chcp 65001 >nul && 7za.exe a -bd -y Кириллица.7z Кириллица.txt"
    
  4. Ensure that Notepad++'s status bar says ANSI as UTF-8 and save the document as a .BAT file:

    2

  5. Open a Command Prompt and run the batch file

Also see here if you want the Command Prompt window to display Unicode characters.

share|improve this answer
    
On my Windows XP SP3 with italian language it doesn't work. I really tried many times with either version 920 and 922 but nothing :( Many tanks anyway for your help. –  giuspen Feb 6 '13 at 21:20
    
Any errors? Works fine in Win7 x64 (English). I'll see if I can find something that works in XP as well. –  Karan Feb 6 '13 at 23:18
    
The errors are the same of the original post, empty archive created with gibberish letters and "cannot find one file". I'll try on Win7 x64 (italian) to see if it works there. –  giuspen Feb 7 '13 at 7:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.