-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unicode filenames do not work in Windows #84
Comments
For the record: I’m now using the following workaround (as Rails initializer) and so far everything works well: module FixRubyzipUnicodeFilenames
# Language encoding flag (EFS) bit
EFS = 0b100000000000
def initialize(*)
super
# Make sure the EFS flag is set, so that unicode filenames are decoded correctly in Windows.
# “Compressed folders” in Windows 7 and newer support unicode filenames natively; for older
# versions of Windows (Vista and below) a recent version of WinZip, 7-Zip, … is needed.
@gp_flags |= EFS
end
end
module Zip
class ZipEntry
prepend ::FixRubyzipUnicodeFilenames
end
end So in fact I’m just always setting the EFS flag when creating an archive – are there any downsides of this approach? (Note that at least Mac OS’ native zip support seems to ignore this flag at all and always interprets filenames as UTF-8). UPDATE: This seems to work correctly only on Windows 8 – Win XP and Windows 7 still mangle the filenames. |
Hi! #3 was merged. |
Are you tried last version of rubyzip? Because as i see you using old versions.WBR, Alexander Simonov On Aug 14, 2013, at 1:17 PM, Stefan Daschek notifications@github.com wrote:
|
You’re right, I should have checked this in advance … However, I now tested again with RubyZip 0.9.9 and also with current master (identifies itself as version 0.9.10) – and the problem remains. |
I made a few changes on the master. Can you try it again? Zip.unicode_names = true |
Using non-ASCII locales in any case is a bad idea. |
You’re right. What to you think about creating a page in the RubyZip wiki here on GitHub, containing an overview and summary of the problems with non-ascii filenames? I’d be happy to do a first draft, if you agree. |
Yes it would be greate if you will do it. |
See https://github.com/rubyzip/rubyzip/wiki/Files-with-non-ascii-filenames – feel free to improve :-) I’m closing this issue, as there is no real fix. Thanks for adding |
I’m using Rubyzip 0.9.9 to create a zip archives containing filenames with accented characters on Mac OS and Linux computers. When I then extract those archives on Windows computers (using WinRar, 7-Zip or Windows’ built-in support for “compressed folders”), the filenames get mangled – most accented characters are replaced by 2 other characters, so it looks like the filenames are encoded as UTF-8 but interpreted by Windows as single byte encoding.
I found #3, but as far as I see, this pull request has never been merged.
Is this a known issue? Are there any workarounds?
If it’s possible to fix this with a sane amount of work I’d be glad to help – any pointers appreciated! 😄
The text was updated successfully, but these errors were encountered: