Comments (2)
Please try the code below for an ad-hoc solution. I will need to think a robust way to enable this feature in r2rtf
.
If you still have issue, could you provide additional example using reprex
? https://reprex.tidyverse.org/
the logic of convert_utf8
is from https://stackoverflow.com/questions/66275158/specify-utf-8-character-encoding-in-rtf-the-text-in-utf-8-format-is-correctly
#' Convert UTF text to proper RTF encoding
#'
#' @param x a string
convert_utf8 <- function(x){
stopifnot(length(x) == 1)
x_int <- utf8ToInt(x)
x_char <- ifelse(x_int < 32768,
paste0("\\uc1\\u", x_int, "*"),
paste0("\\uc1\\u", x_int - 65536, "*"))
paste(x_char, collapse = "")
}
library(r2rtf)
library(dplyr)
head(iris) %>%
rtf_title(convert_utf8("标题: abc")) %>%
rtf_body() %>%
rtf_footnote(convert_utf8("脚注")) %>%
rtf_encode() %>%
write_rtf("tmp.rtf")
from r2rtf.
Closing the issue.
With a recent fix in #93, we can use code below for the table.
library(r2rtf)
library(dplyr)
head(iris) %>%
rtf_title(r2rtf:::utf8Tortf("标题: abc")) %>%
rtf_body() %>%
rtf_footnote(r2rtf:::utf8Tortf("中文脚注: abc")) %>%
rtf_encode() %>%
write_rtf("tmp.rtf")
from r2rtf.
Related Issues (20)
- border_first & page_by HOT 3
- Variations in RTF output across package versions HOT 1
- rtf_subline & page_by HOT 2
- Stop assemble_rtf applying header/footer from last .rtf to entire document HOT 7
- Recreating HAMD17 data HOT 1
- Set different border widths within a section HOT 4
- Remove border between the header and body HOT 1
- Is it possible to add a long free text? HOT 5
- Create FAQ vignette HOT 2
- Refresh RTF and derived artifacts under `vignettes/`
- Release r2rtf 1.1.1 HOT 1
- Garbled code about Chinese character HOT 4
- Unnecessary SVG saving in tests?
- Logo.png in page header for summary tables- RTF format HOT 7
- Page Spread HOT 1
- strings dependency HOT 3
- Replace Unicode / LaTeX conversion table with R script HOT 2
- Cannot handle Chinese characters HOT 4
- Release r2rtf 1.1.2
- Blank `Rplots.pdf` generated when running snapshot tests interactively from RStudio HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from r2rtf.