相关疑难解决方法(0)

在C#字符串/字符编码中GetBytes(),GetString()和Convert()之间的区别是什么?

我们无法将Unicode字符串转换为UTF-8字符串以通过网络发送:

// Start with our unicode string.
string unicode = "Convert: \u10A0";

// Get an array of bytes representing the unicode string, two for each character.
byte[] source = Encoding.Unicode.GetBytes(unicode);

// Convert the Unicode bytes to UTF-8 representation.
byte[] converted = Encoding.Convert(Encoding.Unicode, Encoding.UTF8, source);

// Now that we have converted the bytes, save them to a new string.
string utf8 = Encoding.UTF8.GetString(converted);

// Send the converted string using a Microsoft function.
MicrosoftFunc(utf8);
Run Code Online (Sandbox Code Playgroud)

虽然我们已经将字符串转换为UTF-8,但它并没有以UTF-8的形式到达.

c# string unicode encoding utf-8

5
推荐指数
1
解决办法
1万
查看次数

如何将经典asp表格帖子中的UTF-8数据转换为UCS-2以插入SQL Server 2008 r2?

我正在使用Access 2000数据库"现代化"经典的asp应用程序.

我在SQL Server 2008r2上重写了数据库并更改了所有字段以使用更新的unicode启用nchar,nvarchar,ntext并导入旧数据.我还从IIS 6切换到IIS 7

经典的asp使用UTF-8收集和写入数据.

现在,应用程序在网页中正确显示OLD数据,但是当我触摸它时,即:更新或插入数据正在被破坏.我假设在将数据写入SQL服务器之前,我需要以某种方式将UTF-8数据从经典的asp转换为UCS-2.

但是怎么样?

注意:似乎sql server在从access访问导入数据时自动将utf-8数据转换为可用格式.

sql-server ucs2 utf-8 asp-classic

4
推荐指数
1
解决办法
4660
查看次数

标签 统计

utf-8 ×2

asp-classic ×1

c# ×1

encoding ×1

sql-server ×1

string ×1

ucs2 ×1

unicode ×1