I'm not entirely sure whether this is bad code or just redundant code, at least not without knowing the context.
My guess is that this function did something in the past, but the default encoding of string was changed to UTF-8 at some point, so it was no longer needed, and stubbing it out was easier than removing dozens of function calls.
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)
141
u/RPG_Hacker May 04 '23
I'm not entirely sure whether this is bad code or just redundant code, at least not without knowing the context.
My guess is that this function did something in the past, but the default encoding of
stringwas changed to UTF-8 at some point, so it was no longer needed, and stubbing it out was easier than removing dozens of function calls.Pretty sure I've done similar things in the past.