Why does Delphi warn when assigning ShortString to string?

后端 未结 6 1611
栀梦
栀梦 2021-01-07 18:42

I\'m converting some legacy code to Delphi 2010.

There are a fair number of old ShortStrings, like string[25]

Why does the assignment below:

         


        
6条回答
  •  醉梦人生
    2021-01-07 19:09

    ShortStrings don't have a code page associated with them, AnsiStrings do (since D2009).

    The conversion from ShortString to UnicodeString can only be done on the assumption that ShortStrings are encoded in the default ANSI encoding which is not a safe assumption.

提交回复
热议问题