[rkward/releases/0.6.5] /: Fix encoding issue

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Sun Apr 3 19:49:12 UTC 2016


Git commit fdea689aff14696764f4a0c05ff4e8d681393372 by Thomas Friedrichsmeier.
Committed on 03/04/2016 at 19:48.
Pushed by tfry into branch 'releases/0.6.5'.

Fix encoding issue

M  +3    -0    ChangeLog
M  +6    -1    rkward/rbackend/rkrsupport.cpp
M  +1    -1    rkward/rbackend/rpackages/rkward/R/ver.R

http://commits.kde.org/rkward/fdea689aff14696764f4a0c05ff4e8d681393372

diff --git a/ChangeLog b/ChangeLog
index d3cd868..f5f06ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+--- Version 0.6.5a - UNRELEASED
+- Avoid some potential encoding issues, that could cause graphical select.list to fail for certain strings, under some circumstances
+
 --- Version 0.6.5 - Apr-02-2016
 - Add option to override CSS file used for the output window
 - When manually adding pluginmaps, load these after, not before other pluginmaps, by default
diff --git a/rkward/rbackend/rkrsupport.cpp b/rkward/rbackend/rkrsupport.cpp
index c76324c..e3ef219 100644
--- a/rkward/rbackend/rkrsupport.cpp
+++ b/rkward/rbackend/rkrsupport.cpp
@@ -18,6 +18,7 @@
 #include "rkrsupport.h"
 
 #include <Rdefines.h>
+#include <Rversion.h>
 
 // needed to detect CHARSXP encoding
 #define IS_UTF8(x) (Rf_getCharCE(x) == CE_UTF8)
@@ -133,8 +134,12 @@ SEXP RKRSupport::StringListToSEXP (const QStringList& list) {
 
 	SEXP ret = Rf_allocVector (STRSXP, list.size ());
 	for (int i = 0; i < list.size (); ++i) {
-		// TODO: in R 2.13.0 there is Rf_mkCharCE(). This could be used to set unicode strings, directly. But of course, we'd have to check, when exactly this was introduced.
+#if R_VERSION >= R_Version(2,13,0)
+		SET_STRING_ELT (ret, i, Rf_mkCharCE (list[i].toUtf8 (), CE_UTF8));
+#else
+		// TODO Rf_mkCharCE _might_ have been introduced earlier. Check if still an ongoing concern.
 		SET_STRING_ELT (ret, i, Rf_mkChar (RKRBackend::this_pointer->current_locale_codec->fromUnicode (list[i]).data ()));
+#endif
 	}
 	return ret;
 }
diff --git a/rkward/rbackend/rpackages/rkward/R/ver.R b/rkward/rbackend/rpackages/rkward/R/ver.R
index 19b01d7..3f45975 100644
--- a/rkward/rbackend/rpackages/rkward/R/ver.R
+++ b/rkward/rbackend/rpackages/rkward/R/ver.R
@@ -3,4 +3,4 @@
 # rkward/SetVersionNumber.cmake
 
 #' @export
-".rk.app.version" <- "0.6.4z+0.6.5+pre1"
+".rk.app.version" <- "0.6.5"



More information about the rkward-tracker mailing list