0

I got a _n function returning an int with a q string param. Since I'm italian string in param may contain accented letters (such as àèìòù). Those special letters are not rendered correctly in cout and I was trying to use chars, but the concatenation with the + operator is not working.

U = _n("Quanto " + char (232) + " urgente l'evento?");
[Error] invalid operands of types 'const char*' and 'const char [19]' to binary 'operator+'

I also tried different ways such as this

Miky88
  • 1
  • 1
  • Well not really – Miky88 May 21 '21 at 06:42
  • why not? The same answer could apply here. If not you should explain why – 463035818_is_not_an_ai May 21 '21 at 06:44
  • 1
    Relevant to [the underlying issue](https://en.wikipedia.org/wiki/XY_problem), but not to the question that was asked: [How to inject non-ASCII characters into a string literal in C/C++](https://stackoverflow.com/questions/966122/how-to-inject-non-ascii-characters-into-a-string-literal-in-c-c) – JaMiT May 21 '21 at 06:46
  • Actually the concatenation works but the char is rendered as 'broken' @largest_prime_is_463035818 – Miky88 May 21 '21 at 06:48
  • You asked about the error reported by the compiler. Once your code compiles, fixing the functionality is a separate question. However, before posting a new question about it, see [C++ Extended ASCII Code](https://stackoverflow.com/questions/43390280/c-extended-ascii-code). – JaMiT May 21 '21 at 06:49
  • This is an XY problem. Concatenation isn't the problem. The problem is the string encoding and encoding of the COUT. – Alex Shesterov May 21 '21 at 06:50
  • please include a [mcve] of your code in the question. I believe the duplicate is not appropriate for your actual issue but we need more information – 463035818_is_not_an_ai May 21 '21 at 06:50

0 Answers0