I've posted about this issue (I think) on slack a bit earlier, see
https://cpplang.slack.com/archives/C29936TQC/p1549899016010000

On Thu, Mar 14, 2019 at 11:51 PM Matthew Woehlke <[email protected]>
wrote:

> While working on some modernization of my application — in particular,
> converting some UTF-8 literals to use QStringLiteral — I noticed a
> concerning compiler warning:
>
>   warning C4566: character represented by universal-character-name
>   '\uXXXX' cannot be represented in the current code page (1252)
>
> After doing some testing, it turns out that, given code like
> QStringLiteral("\u269E \U0001f387 \u269F"), MSVC is indeed butchering
> the string.
>
> Further investigation shows that the problem seems to be with the
> implementation of QStringLiteral. In particular, it appears that the
> preprocessor initially sees just the raw string literal without the 'u'
> prefix, butchers it, then later "promotes" it to a UTF-16 literal, but
> by then the damage has been done.
>
> While this absolutely feels like a compiler bug, it's an *awful* big
> gotcha that probably should be documented. Also, is there anything that
> Qt can do to work around it? (I know these sorts of macro expansions can
> be tricksy...)
>
> Note: and the *local* work-around is apparently to include the 'u'
> prefix on my own literal; apparently doubling it (`uu"stuff"`) is okay.
>
> --
> Matthew
> _______________________________________________
> Development mailing list
> [email protected]
> https://lists.qt-project.org/listinfo/development
>
_______________________________________________
Development mailing list
[email protected]
https://lists.qt-project.org/listinfo/development

Reply via email to