Displaying 7 results from an estimated 7 matches for "ce_nat".
Did you mean:
cenat
2023 Jan 31
1
Sys.getenv(): Error in substring(x, m + 1L) : invalid multibyte string at '<ff>' if an environment variable contains \xFF
Can we use the "bytes" encoding for such environment variables invalid
in the current locale? The following patch preserves CE_NATIVE for
strings valid in the current UTF-8 or multibyte locale (or
non-multibyte strings) but sets CE_BYTES for those that are invalid:
Index: src/main/sysutils.c
===================================================================
--- src/main/sysutils.c (revision 83731)
+++ src/main/sysutils.c (wo...
2023 Jan 31
1
Sys.getenv(): Error in substring(x, m + 1L) : invalid multibyte string at '<ff>' if an environment variable contains \xFF
On 1/31/23 09:48, Ivan Krylov wrote:
> Can we use the "bytes" encoding for such environment variables invalid
> in the current locale? The following patch preserves CE_NATIVE for
> strings valid in the current UTF-8 or multibyte locale (or
> non-multibyte strings) but sets CE_BYTES for those that are invalid:
>
> Index: src/main/sysutils.c
> ===================================================================
> --- src/main/sysutils.c (revision 83731...
2023 Jan 31
2
Sys.getenv(): Error in substring(x, m + 1L) : invalid multibyte string at '<ff>' if an environment variable contains \xFF
...>> Tomas Kalibera
>>>>> on Tue, 31 Jan 2023 10:53:21 +0100 writes:
> On 1/31/23 09:48, Ivan Krylov wrote:
>> Can we use the "bytes" encoding for such environment variables invalid
>> in the current locale? The following patch preserves CE_NATIVE for
>> strings valid in the current UTF-8 or multibyte locale (or
>> non-multibyte strings) but sets CE_BYTES for those that are invalid:
>>
>> Index: src/main/sysutils.c
>> ===================================================================...
2011 Aug 04
1
slightly speeding up readChar()
...y O(N) memory allocations.
Here they are:
1. In readFixedString in envir.c, an N sized vector is
allocated, and memset to 0. O(N)
2. The file is read into the buffer with con->read O(N) (but this probably can't be dropped)
3. mkChar is called, which calls mkCharLenCE(name, strlen(name), CE_NATIVE);
strlen is O(N)
4. In mkCharLenCE, a loop along the string looks for 0s to tell if the string includes NULs (notice that because strlen was called before, that can't really happen) O(N)
5. A hashcode is computed for the string to see if it is already in memory. That is an O(N) operatio...
2008 Oct 28
2
A question about the API mkchar()
Hi guys,
I've got a question about the API mkchar(). I have met some difficulty
in parsing utf-8 string to mkchar() in R-2.7.0.
I was intending to parse an utf-8 string str_jan (some Japanese
characters such as?, whose utf-8 code is E381B5) to R API SEXP
mkChar(const char *name) , we only need to create the SEXP using the
string that we parsed.
Unfortunately, I found when parsing the
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
2010 Jun 19
1
more powerful iconv
...STRING_ELT(x, i);
top_of_loop:
inbuf = CHAR(si); inb = LENGTH(si);
outbuf = cbuff.data; outb = cbuff.bufsize - 1;
@@ -622,7 +623,7 @@
goto next_char;
}
- if(res != -1 && inb == 0) {
+ if(res != -1 && inb == 0 && !isRawx) {
cetype_t ienc = CE_NATIVE;
nout = cbuff.bufsize - 1 - outb;
@@ -632,7 +633,12 @@
}
SET_STRING_ELT(ans, i, mkCharLenCE(cbuff.data, nout, ienc));
}
- else SET_STRING_ELT(ans, i, NA_STRING);
+ else if(!isRawx) SET_STRING_ELT(ans, i, NA_STRING);
+ else {
+ nout = cbuff.bufsize - 1 - outb;
+ ans...