

Usually, when people talk about converting text to Base64, without even saying it, the implication is that we are going to be using UTF-8 as the encoding scheme.
#Utf 8 converter from binary full
To be specific, I was running into this with writing a custom Base64 encoder function (see full details on that here). However, when you are feeding the result of UNICODE() into something where you don’t control the decoder part, it becomes an issue. Why is this a problem? Well, most of the time it is not as long as you use the same encoding scheme on both ends (input and output) it really doesn’t matter. To show this more clearly, here is table directly from Google Sheets, that show for various input characters, the CODE() function always returns the UTF-32BE value: This is made even more confusing by the fact that the Apps Script part of Google Sheets has an enum specifically for the UTF-8 charset. After a bit of digging, I discovered that, although this is not really documented, most of the Google Sheets functions use UTF-32 (UTF-32BE) as the encoding scheme, whereas I was expecting UTF-8. I recently ran into a head-scratcher of an issue with Google Sheets, where a formula that used the output of the UNICODE() and/or CODE() functions was not matching with the expected value.


The issue – Google Sheets does not use UTF-8 Warning: This post is going to get into the “dangerously nerdy” territory 🙂 Quick links to solution:
