简体   繁体   English

解码UTF-8字符串Swift iOS

[英]Decode UTF-8 String Swift iOS

I am trying to decode a string which is in UTF-8 format, into normal human readable string and tried may codes available on SO. 我正在尝试将UTF-8格式的字符串解码为普通的人类可读字符串,并尝试了可能在SO上可用的代码。 But non of these worked. 但是这些都不起作用。

My demo UTF-8 String is :- 我的演示UTF-8字符串是:-

let demoString: String = "यॠपहलॠपहलॠà¤à¤¾à¤¹à¤¤à¤¯à¥ बहà¤à¥ बहà¤à¥ हालत"

Is there is anyway to decode this UTF-8 String in swift. 反正有没有迅速解码此UTF-8字符串。 Any help would be appricated. 任何帮助都将适用。

let demoString: String = "यॠपहलॠपहलॠà¤à¤¾à¤¹à¤¤à¤¯à¥ बहà¤à¥ बहà¤à¥ हालत"

This defines a perfectly fine string containing some rather weird characters like "à", "¤" and so on. 这定义了一个完美的字符串,其中包含一些相当奇怪的字符,例如“à”,“¤”等。 There is no decoding that can be done here. 这里无法进行解码。 The first character is a "Latin Small Letter A With Grave", U+00E0 or C3A0 in UTF-8 format. 第一个字符是UTF-8格式的“带坟墓的拉丁小写字母A”,U + 00E0或C3A0。

If you want a string with "Hindi" characters - I suppose you mean Devanagari, or Bengali, Gurmukhi, Gujarati etc. , type for example 如果您想要一个带有“印地语”字符的字符串-我想您是说Devanagari或Bengali,Gurmukhi,Gujarati等,请键入

let demoString: String = "ऄइउऋऌऍ"

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

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