Skip to content Skip to sidebar Skip to footer

How To Decode Base64 Unicode String Using T-sql

Can't decode turkish characters in base64 string. Base64 string = 'xJ/DvGnFn8Onw7bDlsOHxLDEnsOcw5w=' When I decode it must be like this : 'ğüişçöÖÇİĞÜÜ' I try to decode

Solution 1:

Your base-64 encoded data contains an UTF-8 string. MS SQL doesn't support UTF-8, only UTF-16, so it fails for any characters outside of ASCII.

The solution is to either send the data as nvarchar right away, or to encode the string as UTF-16 (and send it as varbinary or base-64, as needed).

Based on Erlang documentation, this might require an external library, unicode: http://www.erlang.org/doc/apps/stdlib/unicode_usage.html

Basically, the default seems to be UTF-8, you need to specify UTF-16 manually. UTF-16 support seems a bit clunky, but it should be quite doable.

Post a Comment for "How To Decode Base64 Unicode String Using T-sql"