转换" ??????????"阿拉伯语

编程入门 行业动态 更新时间:2024-10-22 23:14:20
本文介绍了转换" ??????????"阿拉伯语的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在像这样从远程sql服务器获取数据

I am getting data from remote sql server like this .

"USER_NAME" ="???? ??????";

"USER_NAME" = "???? ??????";

我必须获得阿拉伯语用户名的值,但我正在获得??????.我在数据库中归档了navchar类型的文本.我正在使用以下代码行:-

I have to get value of username in arabic language but I am getting ??????. I have navchar type of text filed at database. I am using these lines of code:-

NSString *output = [[feed objectForKey:@"USER_NAME"] stringByReplacingPercentEscapesUsingEncoding:NSUnicodeStringEncoding]; NSLog(@"%@",output);

那我该如何解决呢?

推荐答案

sql服务器显示某些unicode数据可能有两个原因,例如 ????????

There can be two possible reasons for sql server to show some unicode data like ????????

原因1.当unicode数据插入或更新为unicode数据时用户没有为字符串加上 N 前缀的列.

Reason 1. when unicode data wan inserted or updated to that column the user didnt prefix the string with N.

原因2.列本身不是NVARCHAR表示它不允许存储要存储的Unicode字符.

Reason 2. The Column itself isnt NVARCHAR means it doesnt allow storing unicode characters to be stored.

示例

DECLARE @TABLE TABLE (Column1 VARCHAR(100), --<-- VARCHAR DataType Column2 NVARCHAR(100), --<-- NVARCHAR DataType Column3 NVARCHAR(100)COLLATE Arabic_CI_AS --<-- NVARCHAR DataType with specific ) -- arabic collation INSERT INTO @TABLE VALUES ('هذا هو العربي','هذا هو العربي', 'هذا هو العربي'), -- Data with out N Prefix (N'هذا هو العربي',N'هذا هو العربي', N'هذا هو العربي') -- Data with N Prefix SELECT * FROM @TABLE

结果

╔═══════════════╦═══════════════╦═══════════════╗ ║ Column1 ║ Column2 ║ Column3 ║ ╠═══════════════╬═══════════════╬═══════════════╣ ║ ??? ?? ?????? ║ ??? ?? ?????? ║ ??? ?? ?????? ║ ║ ??? ?? ?????? ║ هذا هو العربي ║ هذا هو العربي ║ ╚═══════════════╩═══════════════╩═══════════════╝

只有数据,其中列"允许存储Unicode字符,而当我使用N前缀时,剩下的数据将只显示???????.

Only data Where Column allows unicode characters to be stored and when I used N prefix will have data stored in the rest are only showing ???????.

如果您只是丢失了数据,则可能无法将其转换回unicode/阿拉伯字符.uch:S

In your case you have simply lost the data you cannot possibly convert it back to unicode / Arabic characters . Ouch :S

更多推荐

转换&quot; ??????????&quot;阿拉伯语

本文发布于:2023-11-01 11:44:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1549253.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:阿拉伯语   amp   quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!