FreeCAD/0002-Base-Fix-wrong-character-encoding-for-micro-siemens.patch
Stefan Brüns fa181a18f6 Accepting request 959594 from home:StefanBruens:branches:science
- Add some unit test fixes:
  * 0001-Test-remove-not-needed-u-before-py3-unicode-string.patch
  * 0001-Test-fix-exception-handling-in-tests-for-units.patch
  * 0001-Test-Provide-more-useful-information-when-unit-trans.patch
  * 0002-Base-Fix-wrong-character-encoding-for-micro-siemens.patch
- Update to version 0.19.4:
  * Lots of bugfixes, for details see
    https://github.com/FreeCAD/FreeCAD/releases/tag/0.19.4

OBS-URL: https://build.opensuse.org/request/show/959594
OBS-URL: https://build.opensuse.org/package/show/science/FreeCAD?expand=0&rev=145
2022-03-06 23:24:48 +00:00

48 lines
1.8 KiB
Diff

From a8b903511fead24ac61543ca129eb0737fa2327f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Sat, 5 Mar 2022 00:26:11 +0100
Subject: [PATCH 2/2] Base: Fix wrong character encoding for micro-siemens
Contrary to any other Unit with micro prefix (e.g. ug, uH, uF) the
string was created with a Latin1 encoding instead of UTF-8.
The problem can be verified with these python statements:
```
FreeCAD.Units.schemaTranslate(FreeCAD.Units.MicroSiemens, 0)
FreeCAD.Units.schemaTranslate(FreeCAD.Units.MicroGram, 0)
```
---
src/Base/UnitsSchemaInternal.cpp | 2 +-
src/Base/UnitsSchemaMKS.cpp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Base/UnitsSchemaInternal.cpp b/src/Base/UnitsSchemaInternal.cpp
index 69b65fa9fc..78ea82a6eb 100644
--- a/src/Base/UnitsSchemaInternal.cpp
+++ b/src/Base/UnitsSchemaInternal.cpp
@@ -351,7 +351,7 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
}
else if (unit == Unit::ElectricalConductance) {
if (UnitValue < 1e-9) {
- unitString = QString::fromLatin1("\xC2\xB5S");
+ unitString = QString::fromUtf8("\xC2\xB5S");
factor = 1e-12;
}
else if (UnitValue < 1e-6) {
diff --git a/src/Base/UnitsSchemaMKS.cpp b/src/Base/UnitsSchemaMKS.cpp
index 11d23d7d0b..795b7afc54 100644
--- a/src/Base/UnitsSchemaMKS.cpp
+++ b/src/Base/UnitsSchemaMKS.cpp
@@ -299,7 +299,7 @@ QString UnitsSchemaMKS::schemaTranslate(const Quantity &quant, double &factor, Q
}
else if (unit == Unit::ElectricalConductance) {
if (UnitValue < 1e-9) {
- unitString = QString::fromLatin1("\xC2\xB5S");
+ unitString = QString::fromUtf8("\xC2\xB5S");
factor = 1e-12;
}
else if (UnitValue < 1e-6) {
--
2.35.1