Support non ASCII characters in MR Sets#351
Conversation
| } | ||
|
|
||
| nc = (alnum | '_' | '.' ); # name character (including dots) | ||
| nc = ([^ =]); # name character (all characters except space and equals) |
There was a problem hiding this comment.
This seems excessively lax?
There was a problem hiding this comment.
My thinking was that we're just using this for pattern matching to extract the components of the field rather than actually validating the contents so it doesn't matter too much if it lines up with actual allowed characters.
The attempt to peg it to actual allowed characters in the current version is what's causing the error in tidyverse/haven#788 (and it would be a massive pain to build a character class that matches all potential valid chars from UTF-8 and other encodings). Can tighten it up a bit if there are particular things you're worried about?
There was a problem hiding this comment.
Hey @evanmiller, just following up - keen to get this merged so we can pull the change into haven. Thanks!
|
Thanks @evanmiller! |
From tidyverse/haven#788 - the new MR set changes only support ascii characters in the set name in the ragel parser, but SPSS uses the file code page/UTF-8 for these.
This PR updates the parser to allow for non-ASCII characters, and runs text from the MR set through
readstat_convert()to make sure the character encoding comes in correctly.