简体   繁体   English

日语文化在英语OS中的C#应用​​程序中

[英]Japanese culture in C# application in English OS

I have an application in C# using .net 3.5. 我在使用.net 3.5的C#中有一个应用程序。 Using this application I save an file and zip it using vjlib library and while opening the file I unzip it. 使用此应用程序,我保存文件并使用vjlib库将其压缩,然后在打开文件时将其解压缩。 However when I try to give file name as Japanese when saving it in English OS machine the file while opening it the application it not able to understand Japanese character. 但是,当我尝试将文件名保存为英文OS时将其命名为日语时,在打开应用程序时却无法理解日语字符。 It due to some Windows Language pack etc. 这是由于某些Windows语言包等。

This problem is most likely induced by the application that created the .zip file. 此问题很可能是由创建.zip文件的应用程序引起的。 File names are encoded in 8 bit characters inside the file. 文件名在文件内部以8位字符编码。 The ZIP specification says that the name should be encoded either in code page 437 or in utf-8. ZIP规范说该名称应在代码页437或utf-8中编码。 Code page 437 is the original IBM PC character set, an encoding that doesn't support any Japanese characters. 代码页437是原始的IBM PC字符集,该编码不支持任何日语字符。 It is not unusual for an app to just use its own 8-bit encoding, not untypically determined by the default system code page. 应用程序仅使用其自己的8位编码(并非通常由默认系统代码页确定)的情况并不少见。

The library you use is the .NET runtime support library for JScript. 您使用的库是JScript的.NET运行时支持库。 Not sure it support specifying a different encoding, it is hard to find docs for it these days since it has been deprecated for so long. 不确定它是否支持指定其他编码,由于它已被弃用了很长时间,因此如今很难找到它的文档。 Consider, say, dotnetzip . 考虑一下dotnetzip Its ZipFile class has an AlternateEncoding property you can initialize from Encoding.GetEncoding(). 它的ZipFile类具有AlternateEncoding属性,您可以从Encoding.GetEncoding()进行初始化。 You still need to find out what encoding was used, knowing where the file came from is important help to make the right guess. 您仍然需要找出使用了哪种编码,知道文件的来源对于做出正确的猜测非常重要。 One common code page for Japanese is 932. 日语的一种常见代码页是932。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM