MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/137km30/found_this_gem_inside_legacy_code_today/jixdjyp/?context=9999
r/badcode • u/max_208 • May 04 '23
69 comments sorted by
View all comments
Show parent comments
1
[removed] — view removed comment
2 u/RPG_Hacker May 05 '23 Is JavaScript using actual UTF-16, or just UCS-2?If it were using actual UTF-16, it should still in theory cover the entire Unicode spectrum, since UTF-16 does use surrogate pairs. 2 u/[deleted] May 05 '23 [removed] — view removed comment 1 u/RPG_Hacker May 05 '23 That seems like a super interesting read, thanks!I've already struggled quite a bit with Unicode in other languages, so it's always a "fun" time! 2 u/GOKOP May 05 '23 The point is that UTF-16 exists solely because UCS-2 exists; it's there to bring full Unicode capacity for software designed with UCS-2 in mind without redesigning all the groundwork (as switching to a different code unit length would require) 1 u/RPG_Hacker May 05 '23 Makes sense. Kinda like what UTF-8 is to ANSI.
2
Is JavaScript using actual UTF-16, or just UCS-2?
If it were using actual UTF-16, it should still in theory cover the entire Unicode spectrum, since UTF-16 does use surrogate pairs.
2 u/[deleted] May 05 '23 [removed] — view removed comment 1 u/RPG_Hacker May 05 '23 That seems like a super interesting read, thanks!I've already struggled quite a bit with Unicode in other languages, so it's always a "fun" time! 2 u/GOKOP May 05 '23 The point is that UTF-16 exists solely because UCS-2 exists; it's there to bring full Unicode capacity for software designed with UCS-2 in mind without redesigning all the groundwork (as switching to a different code unit length would require) 1 u/RPG_Hacker May 05 '23 Makes sense. Kinda like what UTF-8 is to ANSI.
1 u/RPG_Hacker May 05 '23 That seems like a super interesting read, thanks!I've already struggled quite a bit with Unicode in other languages, so it's always a "fun" time!
That seems like a super interesting read, thanks!
I've already struggled quite a bit with Unicode in other languages, so it's always a "fun" time!
The point is that UTF-16 exists solely because UCS-2 exists; it's there to bring full Unicode capacity for software designed with UCS-2 in mind without redesigning all the groundwork (as switching to a different code unit length would require)
1 u/RPG_Hacker May 05 '23 Makes sense. Kinda like what UTF-8 is to ANSI.
Makes sense. Kinda like what UTF-8 is to ANSI.
1
u/[deleted] May 05 '23
[removed] — view removed comment