What's the proper way to handle unicode characters in an iOS app that calls the foursquare API?
Our current setup calls the foursquare API from our iOS app, and returns XML (yes, we're changing this to JSON).
While testing our app, we discovered the hard way that this foursquare location borked our app -- apparently because we did not setup to handle the two Emoji characters in the venue name.
What's the proper way to handle unicode characters at each level?
In Objective-C, as we call the foursquare API?
In our our WCF web services, as we return XML data to the app?
In SQL Server 2008, as we store a place name that may contain unicode characters?
On the database side, I know that we need to make some changes to the Collation settings, among other things.
What changes, if any, are needed to support unicode 6.1 correctly in our iOS app and web services?
Thanks!
I'm guessing you are trying to convert a unicode string to another encoding then back to unicode. If the converter doesn't know what the unicode character is then it could do something strange(e.g. the converter might convert one of the new sad pussycat emoji characters to a square root sign).
This might happen without you explicitly doing it depending on how you have your database setup, the XML encoding you use, your HTTP server configuration, etc.
Unicode 6.1 just adds characters, the encoding is exactly the same(i.e. some codes that didn't map to anything now map to things).
Related
I have a logic app which successfully calls a SOAP api and gets an XML string.
The XML encoding is flawed and in original form cannot be decoded by the built in Transform XML.
If I replace ‘xmlns=‘ with ‘xmlns:foo=‘ then the decoder works. My problem is implementing the replace function.
I tried dynamic content in the logic app input and it successfully replaced the required text but also made undesired changes:
• added an ‘x’ at beginning
• \r and \n all over the place
How can replace the text cleanly?
#daniel - As #johns-305 suggested, first thing to take care of should probably be fixing that encoding issue so that your Transform XML can work properly.
Here's great blog post by Logic Apps engineer on how to solve this type of issues:
Support non-UTF payloads in Logic App with a conversion Azure Function
I was fooling around on my phone and decided to try putting an emoji in the url bar of google chrome. I entered in 😀.com, the emoji which is equivalent to unicode U+1F600. Chrome ended up evaluating that as http://xn--e28h.com/, which took me to a "webpage unavailable" screen (ERR_NAME_NOT_RESOLVED). I looked up xn--e28h on godaddy and it was unavailable.
Here are my questions:
Why did 😀 turn into xn--e28h? I don't see any relation with the unicode.
Why are domains of this format unavailable on godaddy?
Bonus question: why can't we put emojis in domain names?
DNS uses a special way to encode Unicode into ASCII. The xn-- prefix says that it's an encoded name, and since the whole name in this case is one Unicode codepoint the rest just looks incomprehensible. You can start reading more about this here.
Most (if not all) top-level domains have rules on which Unicode characters they allow for names in that TLD. For example, .SE only allows those characters that are used in one of the official languages of Sweden. This is entirely a policy thing, so the "why" gets fuzzy.
See 2.
I am trying to create an application in grails, its much like a blogging application. One of the requirement is that the application must support unicode, the user must be able to enter the blog using unicode character. I have changed the database to 'utf8_unicode_ci' and when i directly enter a unicode record to database, the text is displayed in unicode. The problem is when I enter the unicode characters from application, all I get is '?????' characters. How can I modify the application so that it supports unicode characters ?
Probably you didn't setup your database url correctly. Similar question here.
jdbc:mysql:///dbname?useUnicode=true&characterEncoding=utf-8
I'm using phpMailer in a WordPress plugin to send HTML mails. This works very well. But unfortunataly some users have these strange characters on german Umlauts and the for instance.
This normally happens when using a different charset rather than UTF-8 but this is not the case. I don't allow users to change that and as long they don't change the code (what they don't do) there are no hooks or filters to change it too.
The strangest thing is when they send me the exact same message to me and I have no problems on my iPhone
Has anyone experienced similar? I hardly get this support request but every time I have to say that I don't know an answer.
I have a Rails application that allows users to import information from various sources using RSS feeds and such. My default encoding on the database is UTF8 and I've been receiving a lot of exceptions in regards to non-UTF8 data that is coming through the system and crashing once it hits the database.
I'm to appropriately detect the non-UTF8 data using the is_utf8? method on the attributes before a save is done, but I haven't come up with a way to handle it. I've seen iconv to convert but it appears that requires being able to determine what kind of encoding I'm converting from.
Is there a simple way to do a guess conversion or possibly just strip out the non-UTF8 characters and then do the save into the database?
Thanks!
How is non-UTF-8 data making it into the system? Make sure all your pages are served as Content-Type text/html;charset=utf-8 and browsers will always submit UTF-8 data to your forms.
(Of course that still leaves things like mail and uploaded files, but a lot of those kinds of specific context often give you an encoding to go on.)
Iconv is your friend when it comes to switch encodings. To detect encodings there's a little gem available: rchardet We have used it to detect Asian encodings in an attempt to block spam and it worked fine.