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

问题描述

我最近了解到的SQL Server 2005不支持UTF8:

I have recently learned that sql server 2005 does not support UTF8:

http://stackoverflow.com/questions/3336992/utf8-problem-sql-server

我相信它支持UCS-2,但并寻找一种方式来转换UTF8到UCS-2没有的,如果可能的信息丢失。是吗?

I believe it supports UCS-2 though and look for a way to transform UTF8 to UCS-2 without loss of information if possible. Is it?

任何意见将非常欢迎。谢谢!

Any feedback would be very much welcome. Thanks!

基督教

PS:C#preferred( - :

PS: C# preferred (-:

推荐答案

它看起来像你在UTF-8的文本文件的连接codeD,并要重新连接code到UCS-2 。 的StreamReader 的StreamWriter 支持自动编码;你在它们的构造函数提供一个编码对象。

It looks like you have a text file encoded in UTF-8 and you want to re-encode it to UCS-2. StreamReader and StreamWriter support encoding automatically; you supply an Encoding object in their constructors.

您应该能够:

  1. 构造一个 的StreamReader 编码。 UTF8
  2. 构造一个 的StreamWriter ,提供 Encoding.Uni code
  3. 阅读来自读者线,并将其写入作家

这篇关于变换UT8到UCS-2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 02:20