Good day. I'm trying disable warnings (#2548-D and #69-D).
I have them because i created: const char a='Ф'; // it is Cyrillic symbol
I wrote "69,2548" in disable Warnings field in Linker tab.
But every time i compile project there are always appear this warnings. What I'm doing wrong? Thanks!
69: integer conversion resulted in truncation
unicode is not a char, it is more than 8 bits.
since the warning refer to int it must be UTF16
erik
2 Eric. Yes i know. I use string LCD and Cyrillic symbols have 1 byte code in it. But in windows they are presents in two bytes. I noticed that the main part of symbol code in the second byte and just write it in 1 byte.
Sorry for mistake in the name (blushed)
Yes i know. I use string LCD and Cyrillic symbols have 1 byte code in it. But in windows they are presents in two bytes. I noticed that the main part of symbol code in the second byte and just write it in 1 byte. Then I suggest using a typecast rather then disabling warnings (back on the soapbox)
But in windows they are presents in two bytes.
Only if you configure your text editor to do it that way. Which, for what you're trying to do, is quite a bad idea.
And since you didn't even bother to tell which compiler you're talking about, that's about as much help as one could give you.
I use default compiler version in uVision 5.20.0.0
I cleared the field "Misc controls" and tried to use
static_cast<char>('Б')
Warning 69 disappeared, but 2548 still remains.
"Yes i know. I use string LCD and Cyrillic symbols have 1 byte code in it. But in windows they are presents in two bytes. I noticed that the main part of symbol code in the second byte and just write it in 1 byte."
In UTF-8, the Cyrillic characters requires multiple bytes. And you can't strip away some of the leading bytes.
When using an explicit Cyrillic character set, then the characters fits in a single byte. But that means your editor must work in that character set if you want to see the characters correctly in the source code. And it means that the LCD font must use that same Cyrillic character set.
In this specific situation - have you investigated what character set the LCD fonts are using? Do they even contain Cyrillic characters?
I have additional function that converts character code to code of LCD. I have a table like this:
... static_cast<char>('Ф'),0xC8,1, static_cast<char>('Х'),0x58,0, static_cast<char>('Ц'),0xC9,1, static_cast<char>('Ч'),0xCA,1, static_cast<char>('Ш'),0xCB,1, ...
first byte - symbol, second - code in LCD, third - number of page in LCD (it has 2 pages).
I tried to use windows 1251 and it works! All symbols now in 1 byte! There are no warning at all!! Thank you all for your help!
But your code will only work if the code point for the character fits in a char.
If not, then you need to play with wchar or introduce more advanced code.