static-web-apps-cli icon indicating copy to clipboard operation
static-web-apps-cli copied to clipboard

fix: handle Unicode characters in auth emulator usernames

Open keith-oak opened this issue 6 months ago • 0 comments

Summary

  • Fixed issue where usernames containing Unicode characters (emojis, non-Latin text) would cause btoa() to throw an error
  • Applied UTF-8 encoding before base64 encoding to properly handle Unicode characters

Changes

  • Updated saveCookie() function in src/public/auth.html to use btoa(unescape(encodeURIComponent(data))) instead of btoa(data)
  • This ensures Unicode characters are properly encoded to UTF-8 before base64 encoding

Test plan

  • [x] Tested with various Unicode inputs including emojis (😊), Chinese characters (用户), and Arabic text (مستخدم)
  • [x] Verified ASCII characters still work correctly
  • [x] All existing unit tests pass

Fixes #269

🤖 Generated with Claude Code

keith-oak avatar Jun 25 '25 00:06 keith-oak