← Back to team overview

kicad-developers team mailing list archive

Re: UTF-8 change please test on Windows/Mac

 

On 2018-10-18 06:22, John Beard wrote:
Hi Seth,

I noticed in that commit some test data to tools/utf8_test.cpp.
However, the "Utf8AndWx" test case in qa_common doesn't work with
Unicode in the input string.

Doing a quick check back, this never worked, but wasn't covered in the
tests, which only used ASCII literals for the conversion/equality
tests.

Here's a demo patch for the failing tests (adds a test for conversion
of ASCII-only and UTF8 strings, the second one fails). Maybe I'm
holding it wrong, but it seems to me this should work:

    #define UTF8_LITERAL "This is a test of UTF-8: ü‱☺😕😱"
// Why so serious?

    UTF8 utf8_inited { UTF8_LITERAL };
    wxString wx_inited { UTF8_LITERAL };

    wxString wx_copied_from_utf8 = utf8_inited;
    BOOST_CHECK_EQUAL( wx_inited, wx_copied_from_utf8 );

Cheers,

John

Hi John-

If you are using comments in a #define, you will need to enclose them in /* */

The other issue is (I think) the very special way wxWidgets deals with UTF8. In particular, it assumes that strings are given as narrow unless specified. I've pushed an update to the QA that passes using linux and Mac. Windows testing would be appreciated

-Seth


Follow ups

References