Displaying 3 results from an estimated 3 matches for "306f".
Did you mean:
306
2016 Jul 07
2
String encoding problem
On Thu, Jul 7, 2016 at 10:11 AM, Duncan Murdoch
<murdoch.duncan at gmail.com> wrote:
> On 07/07/2016 10:57 AM, Hadley Wickham wrote:
>>
>> If you print:
>>
>> "\xc9\x82\xbf"
>>
>> you get
>>
>> "\u0242\xbf"
>>
>> But if you try and evaluate that string you get:
>>
>>> "\u0242\xbf"
2016 Jul 07
0
String encoding problem
...uence of bytes that R doesn't know how to deal with. It tries to interpret it in your locale (UTF-8) just as a guess, but that doesn't quite work. To illustrate, doing this in C locale yields a different result:
> x
[1] "<U+3053><U+3093><U+306B><U+3061><U+306F>"
> y <- iconv(x, from="UTF-8", to = "Shift-JIS")
> y
[1] "\202\261\202\361\202\311\202\277\202\315"
If you want a result that does not depend on your locale and is none of the supported encodings, you have to declare it as bytes (back in UTF-8):
>...
2016 Jul 07
2
String encoding problem
...s that R doesn't know how to deal with. It tries to interpret it in your locale (UTF-8) just as a guess, but that doesn't quite work. To illustrate, doing this in C locale yields a different result:
>
>> x
> [1] "<U+3053><U+3093><U+306B><U+3061><U+306F>"
>> y <- iconv(x, from="UTF-8", to = "Shift-JIS")
>> y
> [1] "\202\261\202\361\202\311\202\277\202\315"
>
> If you want a result that does not depend on your locale and is none of the supported encodings, you have to declare it as bytes...