rPython パッケージを使用して、いくつかの引数を Python コードに渡し、結果を取得しようとしています。しかし、何らかの理由で、Python コードから奇妙なエンコーディングを取得しています。誰かが私に指摘するヒントを持っているかもしれません。
テストする簡単なコードは次のとおりです。
require(rPython)
#pass the test word 'audiention' (in ukrainian)
word<-"аудієнція"
python.assign("input", word)
python.exec("input = input.encode('utf-8')")
python.exec("print input") #the output in console is correct at this step: аудієнція
x<-python.get("input")
cat(x) # the output is: 0C4VT=FVO
python.get の出力が奇妙にエンコードされている理由について、誰か提案がありますか?
私の Sys.getlocale() 出力は次のとおりです。
Sys.getlocale()
[1] "LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=uk_UA.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=uk_UA.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=uk_UA.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=uk_UA.UTF-8;LC_IDENTIFICATION=C"
ヒントを事前にありがとう!