Is there a simple way in objective c to convert all special characters like ë,à,é,ä to the normal characters like e en a?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yep, and it’s pretty simple:
Running that on my machine produces:
Basically, we’re asking the string to transform itself it an
NSData(ie, a byte array) that represents the characters in the string in the ASCII character set. Since not all of the characters in the original string are in ASCII, we tell the string that it’s OK to do a “lossy” conversion. In other words, it’s OK to turn “é” into “e”, and so on.Once we’ve got our byte array, we simply turn it back into a string, and we’re done! 🙂