tunistr5.pp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. {$codepage utf-8}
  2. var
  3. ws: unicodestring;
  4. us: UCS4String;
  5. begin
  6. // the compiler does not yet support characters which require
  7. // a surrogate pair in utf-16
  8. // ws:='鳣ćçŹ你';
  9. // so write the last character directly using a utf-16 surrogate pair
  10. ws:='鳣ćçŹ'#$d87e#$dc04;
  11. if (length(ws)<>8) or
  12. (ws[1]<>'é') or
  13. (ws[2]<>'ł') or
  14. (ws[3]<>'Ł') or
  15. (ws[4]<>'ć') or
  16. (ws[5]<>'ç') or
  17. (ws[6]<>'Ź') or
  18. (ws[7]<>#$d87e) or
  19. (ws[8]<>#$dc04) then
  20. halt(1);
  21. us:=UnicodeStringToUCS4String(ws);
  22. if (length(us)<>8) or
  23. (us[0]<>UCS4Char(unicodechar('é'))) or
  24. (us[1]<>UCS4Char(unicodechar('ł'))) or
  25. (us[2]<>UCS4Char(unicodechar('Ł'))) or
  26. (us[3]<>UCS4Char(unicodechar('ć'))) or
  27. (us[4]<>UCS4Char(unicodechar('ç'))) or
  28. (us[5]<>UCS4Char(unicodechar('Ź'))) or
  29. (us[6]<>UCS4Char($2F804)) or
  30. (us[7]<>UCS4Char(0)) then
  31. halt(2);
  32. ws:=UCS4StringToUnicodeString(us);
  33. if (length(ws)<>8) or
  34. (ws[1]<>'é') or
  35. (ws[2]<>'ł') or
  36. (ws[3]<>'Ł') or
  37. (ws[4]<>'ć') or
  38. (ws[5]<>'ç') or
  39. (ws[6]<>'Ź') or
  40. (ws[7]<>#$d87e) or
  41. (ws[8]<>#$dc04) then
  42. halt(3);
  43. end.