FreeCAD/0002-Base-Fix-wrong-character-encoding-for-micro-siemens.patch

48 lines
1.8 KiB
Diff
Raw Normal View History

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