本文介绍了`format`对UTF-8字符串有什么作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

在文档中,format应该执行以下操作:

From the documentation, format should do the following:

现在,如何使用以下示例:

Now how does that go along with the following example:

> format("\u2264")
[1] "="

任何人都可以解释发生了什么事吗?

Can anyone explain what is going on?

我在Windows上使用R.该问题出现在R 3.3、3.4和3.5中.该问题在Linux上没有出现.

I'm using R on Windows. The problem appears in R 3.3, 3.4 and 3.5.The problem does not appear on Linux.

推荐答案

从R ="nofollow noreferrer">文档:

您可以尝试运行Sys.getenv("LANG")来查看当前的R环境编码是什么.假设它是UTF-8,那么看到是有意义的,因为这是Unicode文字\u2264的UTF-8表示形式.

You may try running Sys.getenv("LANG") to see what your current R environment encoding is. Assuming it be UTF-8, then seeing makes sense, as this is the UTF-8 representation of the Unicode literal \u2264.

注意:在我的R工具中,我得到作为format("\u2264")的输出,与Unicode表相比是正确的.也许您的问题中有错字.

Note: I get as the output for format("\u2264") in my R tool, which is correct as compared against the Unicode tables. Perhaps you have a typo in your question.

这篇关于`format`对UTF-8字符串有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 17:13