5 Matching Annotations
- Mar 2023
-
github.com github.com
-
user = User.new(password: "あ" * 25) # 25 characters, 75 bytes
characters vs. bytes
-
- Nov 2022
-
developer.mozilla.org developer.mozilla.org
-
The btoa() function takes a JavaScript string as a parameter. In JavaScript strings are represented using the UTF-16 character encoding: in this encoding, strings are represented as a sequence of 16-bit (2 byte) units. Every ASCII character fits into the first byte of one of these units, but many other characters don't. Base64, by design, expects binary data as its input. In terms of JavaScript strings, this means strings in which each character occupies only one byte. So if you pass a string into btoa() containing characters that occupy more than one byte, you will get an error, because this is not considered binary data:
-
If you need to encode Unicode text as ASCII using btoa(), one option is to convert the string such that each 16-bit unit occupies only one byte.
-
- Mar 2022
-
code.visualstudio.com code.visualstudio.com
-
ambiguous and invisible Unicode characters
'е' != 'e'
-
- Apr 2021
-
en.wikipedia.org en.wikipedia.org