You know how it is... you thought the text in the file you bulk inserted was CP-1252. You start using it, and after a while wonder why it seems to have a few bits of garbage in it, and eventually realize that the file you loaded was actually UTF-8.

Here are two functions that might help you unmangle UTF-8 text that's been loaded into a varchar column. The second one has better error checking, but it's probably rather slow if the number of non-ASCII characters in your column is small.

quote:You know how it is... you thought the text in the file you bulk inserted was CP-1252. You start using it, and after a while wonder why it seems to have a few bits of garbage in it, and eventually realize that the file you loaded was actually UTF-8.

The forgotten proc "utf8_to_utf16" to the rescue Amazing stuff! not surprised it came from you Arnold.