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
Unzip cyrillic text in win1251 encoding #39
Comments
Exactly what are you trying to do? The library has no native support for charsets other than UTF-8 and a basic ASCII encoding, if you want to use a different encoding you must make the transformation yourself. |
I get it. It seems the problem is not solved by JS :( |
The best solution is usually to use UTF-8 all the way through, if that is not an option, for instance because an external source provide data in a different format you'll have to write a converter. It's not that difficult, you just need a table of the Unicode values of the 256 characters in CP1251: http://en.wikipedia.org/wiki/Cp1251 For instance when you find the character with code 192 you should convert it to 0x410 (1040 in decimal), and so forth. |
The problem is that not always the file will be in cp1251, it can be in other encodings, but thanks for the answer! |
Yes Jacob is right, zip.js can't support all encodings because it's beyond its scope. The right option here is to write your own Reader and Writer constructors instead of using TextReader/TextWriter. |
Actually, I am wrong, there's maybe a fix (for file data) by using FileReader#readAsText 2nd parameter... |
I will try |
Thanks! |
Thanks for the help! Work, but not for zip.js :) |
I think I just have to change the |
Thanks! :) |
Hi! And it may be need to add an additional parameter to the "charset" TextWriter to specify the encoding, and use like this? : |
Hi :) I may be missing something here but I don't really what's wrong with the current implementation of HttpReader constructor. There are 2 main use cases when using it:
Could you explain me when using "Content-Type" header is really useful? |
There is no easy way to convert the encoding but to specify when readAsText.
Content-Type is not strictly required (in zip.js), but improves the semantics. |
Алексей(cp1251).zip -> Àëåêñåé(cp1252).unzip (must be utf8 :) )
The text was updated successfully, but these errors were encountered: