[chronojump] More unicode fixes, using \u instead of \U
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] More unicode fixes, using \u instead of \U
- Date: Thu, 21 Nov 2019 15:42:19 +0000 (UTC)
commit fc835adcc5d5ab86bbee23e1a05ae37772e00061
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Nov 21 16:41:37 2019 +0100
More unicode fixes, using \u instead of \U
encoder/graph.R | 7 ++++---
r-scripts/maximumIsometricForce.R | 6 +++---
src/gui/forceSensor.cs | 3 +++
src/util.cs | 14 +++++++++++++-
4 files changed, 23 insertions(+), 7 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index 0401adc9..5c5407b4 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -85,11 +85,12 @@ checkUnicodeWorks <- function()
tryCatch (
{
#this can make the test fail
- #plot(1,1, xlab="unicode stuff: \U00ED \U00E1")
+ #plot(1,1, xlab="unicode stuff: \u00ED \u00E1")
+ #maybe it failed because in the past was together and with \U
#just print and is safer:
- print("unicode stuff: \U00ED \U00E1")
+ print("unicode stuff: \u00ED \u00E1")
if(DEBUG)
- write("unicode stuff: \U00ED \U00E1", DebugFileName, append=TRUE)
+ write("unicode stuff: \u00ED \u00E1", DebugFileName, append=TRUE)
return(TRUE)
},
diff --git a/r-scripts/maximumIsometricForce.R b/r-scripts/maximumIsometricForce.R
index e2abb28f..dd19d5b7 100644
--- a/r-scripts/maximumIsometricForce.R
+++ b/r-scripts/maximumIsometricForce.R
@@ -331,9 +331,9 @@ drawDynamicsFromLoadCell <- function(
}
text(x = (dynamics$startTime + (dynamics$time[endImpulseSample] -
dynamics$time[startImpulseSample])*0.66), y = mean(dynamics$f.raw[startImpulseSample:endImpulseSample])*0.66,
- labels = paste("Impulse =", round(impulse, digits = 2), "N\U00B7s"), pos = 4, cex = 1.5)
+ labels = paste("Impulse =", round(impulse, digits = 2), "N\u00B7s"), pos = 4, cex = 1.5)
- impulseLegend = paste("Impulse", impulseOptions$start, "-", impulseOptions$end, " = ",
round(impulse, digits = 2), " N\U00B7s", sep = "") #\U00B7 is ·
+ impulseLegend = paste("Impulse", impulseOptions$start, "-", impulseOptions$end, " = ",
round(impulse, digits = 2), " N\u00B7s", sep = "") #\u00B7 is ·
}
#Plotting not analysed data
@@ -411,7 +411,7 @@ drawDynamicsFromLoadCell <- function(
legendText = c(
paste("Fmax =", round(dynamics$fmax.fitted, digits = 2), "N"),
#paste("K = ", round(dynamics$k.fitted, digits = 2),"s^-1"),
- paste("K = ", round(dynamics$k.fitted, digits = 2),"s\U207B\U00B9"),
+ paste("K = ", round(dynamics$k.fitted, digits = 2),"s\u207B\u00B9"),
paste("tau = ", round(dynamics$tau.fitted, digits = 2),"s")
)
legendColor = c("blue", "blue", "blue")
diff --git a/src/gui/forceSensor.cs b/src/gui/forceSensor.cs
index 144c3374..125ca6fe 100644
--- a/src/gui/forceSensor.cs
+++ b/src/gui/forceSensor.cs
@@ -1805,6 +1805,9 @@ LogB.Information(" fs R ");
duration = Convert.ToInt32(spin_force_duration_seconds.Value);
string title = lastForceSensorFile;
+ if (UtilAll.IsWindows())
+ title = Util.ConvertToUnicode(title);
+
if (title == null || title == "")
title = "unnamed";
else
diff --git a/src/util.cs b/src/util.cs
index 41007183..296d8217 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -2258,7 +2258,19 @@ public class Util
if (' ' <= c && c <= '~')
sb.Append(c);
else
- sb.AppendFormat("\\U{0:X4}", (int)c);
+ {
+ //old: C#
+ //sb.AppendFormat("\\U{0:X4}", (int)c);
+ //On R, note:
+ //\Unnnn 1-8 hex digits (so this can have problems when a unicode char is at
the side of another char
+ // \U00E1 2 : works
+ // \U00E12 : does not work, tries to find a unicode char different than
the U00E1
+ //\unnnn 1-4 hex digits
+ // \u00E1 2 : works
+ // \u00E12 : works
+ //https://stat.ethz.ch/R-manual/R-devel/library/base/html/Quotes.html
+ sb.AppendFormat("\\u{0:X4}", (int)c);
+ }
}
return sb.ToString();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]