简体   繁体   中英

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. But non of these worked.

My demo UTF-8 String is :-

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

Is there is anyway to decode this UTF-8 String in swift. 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.

If you want a string with "Hindi" characters - I suppose you mean Devanagari, or Bengali, Gurmukhi, Gujarati etc. , type for example

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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