I'm trying to create arhive with file which contains ballon (U+1F388) symbol in its name and 7z doesn't allow me:
$ touch $'\360\237\216\210'.txt $ 7z a test.7z *.txt 7-Zip [64] 15.09 beta : Copyright (c) 1999-2015 Igor Pavlov : 2015-10-16 p7zip Version 15.09 beta (locale=en_US.utf8,Utf16=on,HugeFiles=on,64 bits,8 CPUs Intel(R) Core(TM) i7-3820 CPU @ 3.60GHz (206D7),ASM,AES-NI) Scanning the drive: WARNING: No more files ������.txt 0 files, 0 bytes Creating archive: test.7z Items to compress: 0 Files read from disk: 0 Archive size: 32 bytes (1 KiB) Scan WARNINGS for files and folders: ������.txt : No more files ---------------- Scan WARNINGS: 1
Everything is ok with -no-utf16
flag, but I want to pass this archive to Windows users as well and I'm not sure whether it will work that way.
I also have the same problem with few more symbols. I'm attaching tar arhive with example files, hope it helps. (Most other unicode symbols works ok.)
In case you wondering why do I need such exotic symbols: these are all real files that I downloaded with youtube-dl from Instagram.
7-Zip (windows) uses utf-16 for internal things.
p7zip uses 32-bit wchar_t (that can store utf-32 character) for internal things.
That character (1F388) uses one utf-32 symbol or two utf-16 characters.
p7zip converts original utf-8 string to internal wchar_t string and then back to utf-8 in another functions. Maybe there is problem in that code.
Original 7-zip (for windows) code doesn't use 32-bit wchar_t. So it doesn't contain the code for that case.
Thank you for your support of p7zip.
The next version of p7zip will have a fix.
You can apply this patch before rebuilding p7zip from sources.
file
CPP\Common\StringConvert.cpp
replace
if ((0xd800 <= srcString[i] && srcString[i] <= 0xdbff) && ((i + 1) < srcString.Len()) &&
(0xdc00 <= srcString[i + 1] && srcString[i + 1] <= 0xdf00)) {
by
if ((0xd800 <= srcString[i] && srcString[i] <= 0xdbff) && ((i + 1) < srcString.Len()) &&
(0xdc00 <= srcString[i + 1] && srcString[i + 1] < 0xE000)) {
Many thanks!
Please try p7zip 15.14.