<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Graeme Geldenhuys via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>> schrieb am Di., 9. März 2021, 00:56:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
On 07/03/2021 5:48 pm, Nikolay Nikolov via fpc-pascal wrote:<br>
> It depends on what you mean by "just working".<br>
<br>
No, "just worked" is exactly what it says on the tin. It is FPC that<br>
overcomplicating matters.<br>
<br>
<br>
As an example, here is Java that also uses UTF-16 encoding, just like<br>
FPC's UnicodeString type.<br>
<br>
====================================<br>
$ cat UnicodeTest.java<br>
class UnicodeTest {<br>
<br>
public static void main(String[] args) {<br>
String s = "⌘⌥⌫⇧^";<br>
System.out.println(s);<br>
System.out.println(s.charAt(0));<br>
System.out.println(String.format("%x",s.codePointAt(0)));<br>
}<br>
}<br>
====================================<br>
<br>
Now lets compile and run that.<br>
<br>
$> javac UnicodeTest.java<br>
$> java UnicodeTest<br>
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on<br>
⌘⌥⌫⇧^<br>
⌘<br>
2318<br>
<br>
Yes, it just worked.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">That is because the Java runtime contains all the conversion code necessary. In FPC we simply don't do that, cause it either requires linking to the C library (especially for simple utilities that can be easily avoided) or requires a huge amount of conversion tables. Thus developers need to explicitly opt in for using Unicode conversions by including a WideString manager. </div><div dir="auto"><br></div><div dir="auto">FPC is not Java. In FPC you have more fine-grained control over the resulting binary than "install big, fat runtime". Not to mention that FPC can target resource constrained systems as well.</div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div></div>