Displaying 9 results from an estimated 9 matches for "utf8locale".
2023 Jan 31
1
Sys.getenv(): Error in substring(x, m + 1L) : invalid multibyte string at '<ff>' if an environment variable contains \xFF
...ocVector(STRSXP, i));
- for (i = 0, e = environ; *e != NULL; i++, e++)
- SET_STRING_ELT(ans, i, mkChar(*e));
+ for (i = 0, e = environ; *e != NULL; i++, e++) {
+ cetype_t enc = known_to_be_latin1 ? CE_LATIN1 :
+ known_to_be_utf8 ? CE_UTF8 :
+ CE_NATIVE;
+ if (
+ (utf8locale && !utf8Valid(*e))
+ || (mbcslocale && !mbcsValid(*e))
+ ) enc = CE_BYTES;
+ SET_STRING_ELT(ans, i, mkCharCE(*e, enc));
+ }
#endif
} else {
PROTECT(ans = allocVector(STRSXP, i));
@@ -416,11 +424,14 @@
if (s == NULL)
SET_STRING_ELT(ans, j, STRING_ELT(...
2005 Nov 11
1
undefined symbol in grDevices.so
Hello
I'm trying to use rpy with latest R (2.2.0), but unfortunately it
seems there is some kind of undefined symbol in grDevices.so
(utf8locale)
Within python, this message appears:
>>> import rpy
Error in dyn.load(x, as.logical(local), as.logical(now)) :
unable to load shared library
'/usr/local/lib/R/library/grDevices/libs/grDevices.so':
/usr/local/lib/R/library/grDevices/libs/grDevices.so: undefined
symbol:...
2023 Jan 31
1
Sys.getenv(): Error in substring(x, m + 1L) : invalid multibyte string at '<ff>' if an environment variable contains \xFF
...e = environ; *e != NULL; i++, e++)
> - SET_STRING_ELT(ans, i, mkChar(*e));
> + for (i = 0, e = environ; *e != NULL; i++, e++) {
> + cetype_t enc = known_to_be_latin1 ? CE_LATIN1 :
> + known_to_be_utf8 ? CE_UTF8 :
> + CE_NATIVE;
> + if (
> + (utf8locale && !utf8Valid(*e))
> + || (mbcslocale && !mbcsValid(*e))
> + ) enc = CE_BYTES;
> + SET_STRING_ELT(ans, i, mkCharCE(*e, enc));
> + }
> #endif
> } else {
> PROTECT(ans = allocVector(STRSXP, i));
> @@ -416,11 +424,14 @@
> if...
2023 Jan 31
2
Sys.getenv(): Error in substring(x, m + 1L) : invalid multibyte string at '<ff>' if an environment variable contains \xFF
...gt; ===================================================================
>> --- src/main/sysutils.c (revision 83731)
.....
>>
>> Here are the potential problems with this approach:
>>
>> * I don't know whether known_to_be_utf8 can disagree with utf8locale.
>> known_to_be_utf8 was the original condition for setting CE_UTF8 on
>> the string. I also need to detect non-UTF-8 multibyte locales, so
>> I'm checking for utf8locale and mbcslocale. Perhaps I should be more
>> careful and test for (enc == CE_UTF8) ||...
2023 Jan 30
2
Sys.getenv(): Error in substring(x, m + 1L) : invalid multibyte string at '<ff>' if an environment variable contains \xFF
/Hello.
SUMMARY:
$ BOOM=$'\xFF' LC_ALL=en_US.UTF-8 Rscript --vanilla -e "Sys.getenv()"
Error in substring(x, m + 1L) : invalid multibyte string at '<ff>'
$ BOOM=$'\xFF' LC_ALL=en_US.UTF-8 Rscript --vanilla -e "Sys.getenv('BOOM')"
[1] "\xff"
BACKGROUND:
I launch R through an Son of Grid Engine (SGE) scheduler, where the R
2005 Jul 20
1
(PR#8017) build of REventLoop package crashes with 2.1 due
...> < extern char R_StdinEnc[31] INI_as(""); /* Encoding assumed for stdin
> */
> ---
>> extern char* R_TempDir INI_as(NULL); /* Name of per-session dir */
> 530d528
> < extern void R_setupHistory();
> 541,542c539
> < LibExtern Rboolean utf8locale INI_as(FALSE); /* is this a UTF-8 locale? */
> < LibExtern Rboolean mbcslocale INI_as(FALSE); /* is this a MBCS locale? */
> ---
>> extern Rboolean utf8locale INI_as(FALSE); /* is this a UTF-8 locale? */
> 596a594
>> # define duplicated Rf_duplicated
> 633...
2004 Apr 18
0
[patch] R-1.9.0: compile error without nl_langinfo(CODESET) (PR#6789)
...n/main.c 2004-04-17 15:22:37 +0200
@@ -37,7 +37,7 @@
# include <locale.h>
#endif
-#ifdef HAVE_LANGINFO_H
+#ifdef HAVE_LANGINFO_CODESET
# include <langinfo.h>
#endif
@@ -459,7 +459,7 @@
RSetConsoleWidth();
}
#endif
-#ifdef HAVE_NL_LANGINFO
+#ifdef HAVE_LANGINFO_CODESET
utf8locale = strcmp(nl_langinfo(CODESET), "UTF-8") == 0;
#endif
/* gc_inhibit_torture = 0; */
--- src/main/platform.c.old 2004-04-17 15:06:04 +0200
+++ src/main/platform.c 2004-04-17 15:22:54 +0200
@@ -886,7 +886,7 @@
#ifdef HAVE_LOCALE_H
# include <locale.h>
#endif
-#ifdef HAVE_LANGI...
2005 Jul 19
0
build of REventLoop package crashes with 2.1 due tosyntax error in Defn.h (PR#8017)
...(NULL); /* Name of per-session
dir */
< extern char R_StdinEnc[31] INI_as(""); /* Encoding assumed for stdin
*/
---
> extern char* R_TempDir INI_as(NULL); /* Name of per-session dir */
530d528
< extern void R_setupHistory();
541,542c539
< LibExtern Rboolean utf8locale INI_as(FALSE); /* is this a UTF-8 locale? */
< LibExtern Rboolean mbcslocale INI_as(FALSE); /* is this a MBCS locale? */
---
> extern Rboolean utf8locale INI_as(FALSE); /* is this a UTF-8 locale? */
596a594
> # define duplicated Rf_duplicated
633c631
< # define Mbrtowc...
2011 Aug 04
1
slightly speeding up readChar()
...so that instead of allocating it a new the old pointer is used (?).
In any case, here is an updated readFixedString(), which would drop 2 O(N) operations.
---
static SEXP
readFixedString(Rconnection con, int len, int useBytes)
{
SEXP ans;
char *buf;
int m;
const void *vmax = vmaxget();
if(utf8locale && !useBytes) {
int i, clen;
char *p, *q;
p = buf = (char *) R_alloc(MB_CUR_MAX*len+1, sizeof(char));
memset(buf, 0, MB_CUR_MAX*len+1);
for(i = 0; i < len; i++) {
q = p;
m = con->read(p, sizeof(char), 1, con);
if(!m) { if(i == 0) return R_NilValue; else break;}...