Reputation: 23062
The RubyZip library is happy to let me create filenames with accented characters:
require 'zip/zip'
Zip::ZipFile.open("my.zip", Zip::ZipFile::CREATE) { |zipfile|
zipfile.get_output_stream("Café.txt") { |f| f.puts "Hello from ZipFile" }
}
But they look corrupted in the resulting zip:
$ unzip -v my.zip
Archive: my.zip
Length Method Size Cmpr Date Time CRC-32 Name
-------- ------ ------- ---- ---------- ----- -------- ----
19 Defl:N 21 -11% 2011-02-11 11:14 c49ac197 Caf??.txt
If I unzip the file on the same Linux system that created it, the filename is restored correctly, but can I trust these to work elsewhere or should I play it safe and dumb down the names?
Upvotes: 0
Views: 769
Reputation: 1006
In general, I would always refrain from using non-ascii characters (which includes accented characters) in any filename -- especially one that's meant to be accessed programmatically, and especially within a compressed file. Not only can it cause a hassle considering other languages that aren't so internationally-sensitive, but decompressors are notoriously bad at dealing with non-ascii characters.
Upvotes: 3