while trying to set some text with special characters to a widget with stylesheets I encountered some encoding problems.
Version: WinCC OA 3.18 P012
Project has been created new and does use UTF-8.
Example:
Widget
Spinbutton (Qt class "QSpinBox"; Same problem appears with other widgets as well).
stylesheet.css
Encoding: UTF-8
Content:
Code: Select all
QSpinBox {
qproperty-suffix: "m³";
}
This means the text has been interpreted as character set "Windows-1252" (Pretty sure it is not ISO-8859-1, as "€" displays "€" which matches 1252 and looks different in 8859-1).
Remarks:
1. Adding "@charset "UTF-8";" to the top of file has no effect.
2. Changing the encoding to "Windows-1252" works but is limited to the special characters supported by this character set.
3. Setting the text directly to the ".styleSheet" property somehow works without problems; both with .pnl and .xml files (both encoded in UTTF-8).
What did work, was to encode the stylesheet.css file in UTF-16. But I would prefer to have all my files in UTF-8 and not a mix between encodings.
(Not sure if this is connected, but this page made me try UTF-16: https://wiki.qt.io/Strings_and_encodings_in_Qt#QString)
My questions would be:
1. Is it possible to encode the stylesheet.css in UTF-8 (and have it work correctly)?
2. Why does the .styleSheet property behave differently from the stylesheet.css file (it is quite handy for quick testing)?
Thanks for your help.
BR
Dennis