Github user CHOIJAEHONG1 commented on a diff in the pull request:
https://github.com/apache/spark/pull/7494#discussion_r38078086
--- Diff: R/pkg/inst/tests/test_sparkSQL.R ---
@@ -417,6 +417,32 @@ test_that("collect() and take() on a DataFrame return
the same number of rows an
expect_equal(ncol(collect(df)), ncol(take(df, 10)))
})
+test_that("collect() support Unicode characters", {
+ markUtf8 <- function(s) {
+ Encoding(s) <- "UTF-8"
+ s
+ }
+
+ lines <- c("{\"name\":\"ìë
íì¸ì\"}",
+ "{\"name\":\"æ¨å¥½\", \"age\":30}",
+ "{\"name\":\"ããã«ã¡ã¯\", \"age\":19}",
+ "{\"name\":\"Xin chà o\"}")
+
--- End diff --
I guess this is related to the R interpreter. I made some to see the
behavior of the R interpreter with different locale.
You can see R adds 80 before 90 with the UTF-8 locale. This looks the
reason why the test case passed with UTF-8 not using `markUtf8`.
test.R
```
a<-"ê°"
Encoding(a)
print(serialize(a, connection=NULL))
```
with UTF-8 locale the output is
```
$ r -f test.R
> a<-"ê°"
> Encoding(a)
[1] "UTF-8"
> print(serialize(a, connection=NULL))
[1] 58 0a 00 00 00 02 00 03 02 00 00 02 03 00 00 00 00 10 00 00 00 01 00
00 80
[26] 09 00 00 00 03 ea b0 80
```
with C(ascii) locale the output is
```
$ r -f test.R
> a<-"ê°"
> Encoding(a)
[1] "unknown"
> print(serialize(a, connection=NULL))
[1] 58 0a 00 00 00 02 00 03 02 00 00 02 03 00 00 00 00 10 00 00 00 01 00
00 00
[26] 09 00 00 00 03 ea b0 80
```
---
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]