Github user sun-rui commented on a diff in the pull request:
https://github.com/apache/spark/pull/7494#discussion_r35407059
--- Diff: R/pkg/R/deserialize.R ---
@@ -56,8 +56,10 @@ readTypedObject <- function(con, type) {
readString <- function(con) {
stringLen <- readInt(con)
- string <- readBin(con, raw(), stringLen, endian = "big")
- rawToChar(string)
+ raw <- readBin(con, raw(), stringLen, endian = "big")
+ string <- rawToChar(raw)
+ Encoding(string) <- "UTF-8"
+ enc2native(string)
--- End diff --
I suspect I made a mistake here. It semms that enc2native just change the
encoding mark, but does not convert the character from current encoding to the
native encoding (iconv() can do this). As described in
https://cran.r-project.org/doc/manuals/r-release/R-ints.html#Encodings-for-CHARSXPs,
R can encodings other than that of the current locale, and most of the
character manipulation functions now preserve UTF-8 encodings, we can keep the
string encoding as "UTF-8". So could you try to remove this?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]