>>107834792
>checks if the flag is set (which it always properly was because we were loading data from a UTF-8 database), and converts it to ISO-1 if it is (and I mean actually _convert_)
That's retarded, you're corrupting the data and losing information *100%* of the time that the UTF8 flag is set. If the UTF8 flag is set it means at least 1 character was > 0xff and those characters will be corrupted when converted back. The only useful thing to do when the UTF8 flag is set is to encode to "UTF-8".
$ perl -E 'use Devel::Peek; Dump chr(0xff)'
SV = PV(0x55a1f27fb860) at 0x55a1f25e25b0
REFCNT = 1
FLAGS = (PADTMP,POK,IsCOW,READONLY,PROTECT,pPOK)
PV = 0x55a1f27f9850 "\xFF"\0
CUR = 1
LEN = 16
COW_REFCNT = 0
$ perl -E 'use Devel::Peek; Dump chr(0x100)'
SV = PV(0x55e9e2ee2a80) at 0x55e9e2cc96b0
REFCNT = 1
FLAGS = (PADTMP,POK,IsCOW,READONLY,PROTECT,pPOK,UTF8)
Comment too long. Click here to view the full text.