我正在写一本书,其中将100部荷兰歌曲翻译成波兰语。我很自豪在Win10上使用R-Markdown和Bookdown,并且非常喜欢它!我的所有需求/想法都得到满足/实现,但只有一个:法语(某些荷兰语是从法语借来的)和波兰语字符在一个文档中。这是我的MWE:
在法语环境中,波兰语字符在R中无法正确显示:
# French locale
Sys.setlocale("LC_ALL", "French")
string <- c("Voyez le brick géant que j'examine près du grand wharf","\n", "Zażółć gęślą jaźń")
cat(string)
> Voyez le brick géant que j'examine près du grand wharf
> Zazólc gesla jazn
在波兰语环境中,法语字符未在R中正确显示:
# Polish locale
Sys.setlocale("LC_ALL", "Polish")
string <- c("Voyez le brick géant que j'examine près du grand wharf","\n", "Zażółć gęślą jaźń")
cat(string)
> Voyez le brick géant que j'examine pres du grand wharf
> Zażółć gęślą jaźń
我希望看到的是:
> Voyez le brick géant que j'examine près du grand wharf
> Zażółć gęślą jaźń
如果我在R-markdown的开头设置区域设置X,则html,pdf和epub对于该区域设置中使用的字符看起来是完美的,来自第二个区域设置的字符以“基本”拉丁字母显示。在输出文件(html和tex)中,除了“ manual gsub”之外,还有其他方法吗?
已解决!对于波兰语区域外的所有特殊字符,我正在使用:1.乳胶转义码供参考,2.其余的HTML实体代码。现在看起来很棒!