array of wide char warning - Printable Version +- Atozed Forums (https://www.atozed.com/forums) +-- Forum: Indy (https://www.atozed.com/forums/forum-8.html) +--- Forum: Indy General Discussion (https://www.atozed.com/forums/forum-9.html) +--- Thread: array of wide char warning (/thread-1712.html) |
array of wide char warning - Madammar - 06-08-2020 i have this array of widechar Code: SpecialChars: array[1..60] of WideChar = ( i got this compiler warning during compilation Quote:[dcc32 Warning] SimpleHTML.pas(203): W1063 Widening given AnsiChar constant (#$F7) to WideChar lost information any idea how to handle this warning ? RE: array of wide char warning - rlebeau - 06-08-2020 First, this has nothing to do with Indy, so you should not have posted this in an Indy forum. A general Delphi forum would have been more appropriate. Second, there is no #$F7 (or #0127) literal in the code you have showed. However, that being said - more than half of your literal values are subject to the {$HIGHCHARUNICODE} compiler directive. Do you have that directive set to ON or OFF? I suspect it is OFF, which is the default: Quote:When HIGHCHARUNICODE is OFF: So try turning the directive ON for your array: Code: {$HIGHCHARUNICODE ON} Alternatives are to either: - initialize your array using type-casted integers: Code: SpecialChars: array[1..60] of WideChar = ( - initialize your array using a Unicode string literal instead of individual character literals: Code: SpecialChars: array[1..60] of WideChar = ' ©®™¹²³"&<>–—‘’“”•†‡′″‹›˜ˆ♠♣♥♦◊←→↑↓↔¬¼½¾±«»°«º¡¿€¢£¥¤§¶¯·µ×÷'; - in which case, why not just change the array into a UnicodeString? (make sure to use {$ZEROBASEDSTRINGS OFF} when indexing into the string, if needed): Code: SpecialChars: UnicodeString = ' ©®™¹²³"&<>–—‘’“”•†‡′″‹›˜ˆ♠♣♥♦◊←→↑↓↔¬¼½¾±«»°«º¡¿€¢£¥¤§¶¯·µ×÷'; |