TEncoding.UTF8, B1);
why B1 = B2 ???
B1 = (199, 200, 230, 199, 225, 221, 214, 225)
B2 = (199, 200, 230, 199, 225, 221, 214, 225) 😩😩
When you compare using "=" between objects is much different when you compare values of them. Pascal, Java, C and others languages you need to use methods to compare values of the object otherwise you compare if tobjects is the same. TBytes is an array of Byte then you need a method to compare using arrays.
I don't compare. I copy value of B1 and B2 from debug watch value
Sorry, maybe you need to put special chars that does not have one of types(ansi or unicode) to be different.
let me make it simple: var ws : ansistring; B1,B2: TBytes; s: string; begin ws := 'Å'; ShowMessage(StringCodePage(ws).ToString); // = 1256 B1 := TEncoding.ANSI.GetBytes(ws); // = 63 B2 := TEncoding.Convert(TEncoding.ANSI, TEncoding.UTF8, s); // = 63 ss := TEncoding.UTF8.GetString(B2); // = ? show ? char 😐 you can test it
Обсуждают сегодня