ISO-8859-2的问题 [英] Problem with ISO-8859-2

查看:50
本文介绍了ISO-8859-2的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这非常奇怪。我通常可以在使用克罗地亚语键盘的应用程序中键入克罗地亚字符(在ISO-8859-2下),但是当我想从代码中使用ISO-8859-2时,我得到例外:

This is very wierd. I can normally type Croatian characters (that are under ISO-8859-2) in the application with Croatian keyboard, but when I want to use ISO-8859-2 from the code I get the exception:

A first chance exception of type 'System.ArgumentException' occurred in mscorlib.ni.dll

Additional information: 'ISO-8859-2' is not a supported encoding name.

这部分代码发生了这种情况:

This happen in this part of code:

byte[] array = UTF8Encoding.UTF8.GetBytes(result.ToCharArray());

string en = UTF8Encoding.GetEncoding("ISO-8859-2").GetString(array, 0, array.Length - 1);

targetLanguage2.Text = en;

是否有ISO-8859-2的另一个名称所以我可以使用克罗地亚字符(或来自其他国家/地区)是在ISO-8859-2)或者我应该用字节码制作自己的地图所以我可以某种方式将UTF-8转换为ISO-8859-2?

Is there another name for ISO-8859-2 so I can use Croatian characters (or from other countries that are under ISO-8859-2) or should I make my own maps with byte codes so I can somehow transform UTF-8 to ISO-8859-2?

我相信这是特定的到Windows Phone 8.我使用最新的Visual Studio 2013更新,如果这对您来说意味着什么。

I believe that this is specific to Windows Phone 8. I am using latest Visual Studio 2013 update if that means anything to you people.

开发技术人员,Microsoft认证专家

Development Technician, Microsoft Certified Professional

推荐答案

您误解了UTF8编码的作用。 以下是有效名称列表: 

http:// msdn .microsoft.com / zh-CN / library / windowsphone / develop / t9a3kf7c(v = vs.105).aspx

基本上UTF-8编码会对要发送的字符进行编码以安全的方式通过HTTP。 

Basically UTF-8 encoding encodes your characters to send over HTTP in a safe manner. 


这篇关于ISO-8859-2的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆