by Michael S. Kaplan, published on 2011/04/02 07:03 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2011/04/02/10149149.aspx
It started a while back in There's no "I" in IDN, part 1: If you're not Unicode, you're just wrong!.
And in that blog I mentioned some functions that can't handle Unicode domain names, and thus should never be used in situations where Unicode domain names might be needed or expected.
But there can be another class of usage to look out for -- functions that might be just fine on their own in situations they need but which you have to be careful about using once you move into the world of IDN and EAI and such.
Like the question that came up the other day:
Does anyone know a way to convert full-width characters to half width (or vice versa)? We have a need where when we generate hash of a string that needs to be equal with width insensitivity.
Here is the example of equivalent strings when width is ignored.
Of course the simple answer would be to use LCMapStringW/LCMapStringEx to convert between full and half width.
But if these entries are domain names (they look like email addresses, which contain domain names), then following those rules and using the IDN functions -- in this case IdnToNameprepUnicode -- to do the various conversions (at least for the "domain" piece after the "@" sign) can make a lot more sense.
The issue to the text before the "@" sign is slightly more complicated, so we'll leave that for another time...
But for now, the rule is simple: don't do IDN things with non-IDN functions!
go to newer or older post, or back to index or month or day