Degree symbol error

Well - I finally have somewhat of an answer to the elusive degree symbol bug. As I’m trying to build the app with Qt6 and having to switch to the MSVC build kit - which I’m still having issues with :frowning: - I decided to take a step back and see how my system builds with Qt 5 and the MSVC19 64 bit kit. It should be noted that I’ve been using the GCC MingW kit… which has NEVER given me the the degree symbol error. I got the app to build with MSVC, but lo and behold that stupid bug is there! So it’s not an XML or UTF-8 or time zone / locale issue… it’s an issue with building with Microsoft Visual Studio! - which is what the release builds are using. So the question is - is the issue on Qt’s end or MS’s end?

degree_sign_error

3 Likes

I have FINALLY solved the mystery of the degree symbol! Yea!! :heart_eyes: :tada: :tada:

degree

It’s MS. In their infinite wisdom - unlike the rest of the world - they expect unicode utf-16 to be the default unless you specify the source files to be utf-8. So when you use a unicode char like the degree symbol, which is takes 2 bytes in utf-16 (°) - with utf-8 it treats the string as 2 seperate bytes… thus you get the A°. There’s several work arounds, but since we’re not using a lot of unicode chars there’s an easy way around it… without messing up compiling with GCC.

If anyone notices any places where the apps are showing 2 chars instead of one, let me know, and I can fix the text string.

3 Likes

In the end we found another solution: Tell MSVC to treat the sources as utf8 (as all other compilers do) and its good: fix: UTF-8 sources in MSVC by csett86 · Pull Request #975 · FashionFreedom/Seamly2D · GitHub

This has the advantage that the source stays readable, as it can then contain all utf8 strings verbatim.

This is part of tomorrows weekly release and then also fixed for our windows users.

2 Likes

Well… scrolling down to kit settings that I normally don’t see in Creator I found this: Doh.

utf

2 Likes