New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A bug in plots with Hebrew characters in the figure labels #527

Closed
talgalili opened this Issue Apr 27, 2013 · 9 comments

Comments

3 participants
@talgalili

talgalili commented Apr 27, 2013

Here is a simple example of a file called "test.rmd" which produced the error:

Input file (called "test.rmd")

======================

TEST -Hebrew in figure
-----------------------------

```{r fig.width=7, fig.height=6}
plot(cars, main = "בדיקה")
```

```{r, eval=FALSE}

library(knitr)
knit2html("test.rmd")

```

The output of this file is:

======================
TEST -Hebrew in figure

plot(cars, main = "בדיקה")
## Warning: conversion failure on '׳‘׳“׳™׳§׳”' in 'mbcsToSbcs':
## dot substituted for <d7>
## Warning: conversion failure on '׳‘׳“׳™׳§׳”' in 'mbcsToSbcs':
## dot substituted for <b3>
## Warning: conversion failure on '׳‘׳“׳™׳§׳”' in 'mbcsToSbcs':
## dot substituted for <d7>
## Warning: conversion failure on '׳‘׳“׳™׳§׳”' in 'mbcsToSbcs':
## dot substituted for <b3>
## Warning: conversion failure on '׳‘׳“׳™׳§׳”' in 'mbcsToSbcs':
## dot substituted for <d7>
## Warning: conversion failure on '׳‘׳“׳™׳§׳”' in 'mbcsToSbcs':
## dot substituted for <b3>
## Warning: conversion failure on '׳‘׳“׳™׳§׳”' in 'mbcsToSbcs':
## dot substituted for <d7>
## Warning: conversion failure on '׳‘׳“׳™׳§׳”' in 'mbcsToSbcs':
## dot substituted for <b3>
## Warning: conversion failure on '׳‘׳“׳™׳§׳”' in 'mbcsToSbcs':
## dot substituted for <d7>
## Warning: conversion failure on '׳‘׳“׳™׳§׳”' in 'mbcsToSbcs':
## dot substituted for <b3>
@yihui

This comment has been minimized.

Owner

yihui commented May 23, 2013

Search for Encoding on this page: http://yihui.name/knitr/demo/graphics/

@talgalili

This comment has been minimized.

talgalili commented May 25, 2013

Hi Yihui,
I've went through the entire list of
list.files(system.file('enc', package = 'grDevices'))
And tried using each of them using
pdf.options(encoding = 'CP1250') # or others.

And none have worked (some broke the script from displaying anything, others gave the correct plot's title, but with the errors)

Any thing else I might try?

@talgalili

This comment has been minimized.

talgalili commented May 25, 2013

Extra point:

If I use:
Sys.setlocale( "LC_ALL", "english")
Instead of
Sys.setlocale( "LC_ALL", "hebrew")

I will no longer see the errors. However, the characters in the figure will no longer be Hebrew.

@yihui

This comment has been minimized.

Owner

yihui commented May 25, 2013

You should not change the locale. Perhaps the Cairo device works...

@talgalili

This comment has been minimized.

talgalili commented May 25, 2013

I tried Cairo with both locales - it doesn't work (e.g: I can't seem to see any figure when turning it on)

@yihui

This comment has been minimized.

Owner

yihui commented May 25, 2013

How about the windows() device?

options(device = function(file, width = 7, height = 7, ...) {
  windows(width = width, height = height, ...)
})
@talgalili

This comment has been minimized.

talgalili commented May 25, 2013

Wow, this one works!
I have no idea why though... :)

Thanks.

@Nisus-Liu

This comment has been minimized.

Nisus-Liu commented Dec 8, 2016

Wow!amazing!

@talgalili

This comment has been minimized.

talgalili commented Dec 8, 2016

Thanks Yihui :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment