How do i construct a WideString with a diacratic in a non-unicode Delphi version?

后端 未结 3 1632
小蘑菇
小蘑菇 2021-01-19 07:13

i am trying to construct a (test) WideString of:

á (U+00E1 Small Letter Latin A with acute)

but using it\'s decomp

3条回答
  •  被撕碎了的回忆
    2021-01-19 08:12

    This works in Delphi 5/7:

    var
      test: WideString;
    begin
    
       test := WideChar($0061);
       test := test + WideChar($0301);
    
       MessageBoxW(0, PWideChar(test), 'Character with diacratic', MB_ICONINFORMATION or MB_OK);
    end;
    

    In short:

    • In delphi 5 and delphi 7, it does not appear that concatenating WideChars to WideString works using #$xxxx form literals.
    • # doesn't seem to work as you'd expect for unicode literals.

    • You can't just add two or more widechars in a single expression, like this:

      test := WideChar(a)+WideChar(b);  // won't compile in D5/D7.
      

提交回复
热议问题