tcpstr1.pp 911 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. {$ifdef go32v2}
  2. {$define USE_FPWIDESTRING_UNIT}
  3. {$define USE_UNICODEDUCET_UNIT}
  4. {$endif}
  5. {$ifdef unix}
  6. uses
  7. {$ifdef darwin}iosxwstr{$else}cwstring{$endif};
  8. {$else}
  9. uses
  10. {$ifdef USE_FPWIDESTRING_UNIT}
  11. fpwidestring,
  12. {$endif}
  13. {$ifdef USE_UNICODEDUCET_UNIT}
  14. unicodeducet,
  15. {$endif}
  16. { The unit strings is not really used here,
  17. but simpifies the conditional construction
  18. for fpwidestring and unicodeducet use }
  19. strings;
  20. {$endif}
  21. type
  22. tcpstr1 = type AnsiString(1253);
  23. tcpstr2 = type AnsiString(1251);
  24. var
  25. a1 : tcpstr1;
  26. a2 : utf8string;
  27. a3 : tcpstr2;
  28. u1 : unicodestring;
  29. begin
  30. a1:=' ';
  31. a1[1]:=char($80); // Euro symbol in cp1253
  32. a2:=a1;
  33. if ord(a2[1])<>$E2 then
  34. halt(1);
  35. if ord(a2[2])<>$82 then
  36. halt(2);
  37. writeln('---');
  38. a3:=a1;
  39. if ord(a3[1])<>$88 then
  40. halt(3);
  41. writeln('---');
  42. u1:=a1;
  43. if ord(u1[1])<>$20AC then
  44. halt(4);
  45. writeln('ok');
  46. end.