ripley at stats.ox.ac.uk
2006-Sep-04 20:26 UTC
[Rd] (PR#9201) Unable to save a plot containing Chinese (two-byte)
This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --27464147-689190176-1157401193=:15799 Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-1 Content-Transfer-Encoding: 8BIT Content-ID: <Pine.LNX.4.64.0609042121261.15799 at gannet.stats.ox.ac.uk> On Mon, 4 Sep 2006, Pavel Stranak wrote:> On 4.9.2006, at 21:16, Prof Brian Ripley wrote: > > >Please can we have a full reproducible example, including the locales > >used, and exactly how you 'saved' the plot? (As we do ask.)You have _still_ not told us what we asked, including the locales!> I have used GUI command "File->Save As .." Im Mac GUI.That may well not work, but reports on the Mac GUI are inappropriate for R-bugs.> It works perfectly with the same plots, when I don't use Chinese. > It also works fine, when I use Czech accented characters. At least some of > them are also two-byte in UTF-8.Yes, but Chinese chars are not.> But the problem also occures when I direct pdf device right into the file: > > pdf(file="Rplot.pdf")Incorrect usage.> > plot(1:20, 1:20, main="P??li? ?lu?ou?k? k?? ?p?l ??belsk? ?dy.") > # Czech accents work fine > > plot(1:20, 1:20, main="?P??li? ?lu?ou?k? k?? ?p?l ??belsk? ?dy.") > Error in title(...) : conversion failure in 'mbcsToSbcs' > # One Chinese character => Error > > > > >If Chinese characters are 'two-byte', then this likely will not work (but > >at least European locales on MacOS X are UTF-8, so I expected Chinese ones > >to be also).> As far as I know, UTF-8 contains at least 1byte and 2byte characters.and 3 byte and 4 byte chars, and potentially up to 6.> All the chinese characters are represented by two bytes in UTF-8.Please give your reference! They are in the Unicode ranges from 2F00, and characters above 07Ff need 3 or more bytes in UTF-8. http://www.cl.cam.ac.uk/~mgk25/unicode.html> The characters I have used (but that fail to display in your bug-tracking > system) > are two characters "Chinese language". > > My locales are set to UTF-8.That is *not* a locale but a character encoding.> I have not set any fonts in R because all the Chinese characters display fine > both in the console and the plot.But not in pdf, as you said. You really have failed to read the references, including the help page and tutorial I very kindly pointed you to. In case it has still not got through to you: PDF is not written in UTF-8 and most fonts do not include Chinese ideographs, including Helvetica, the default font for PDF. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 --27464147-689190176-1157401193=:15799--
Reasonably Related Threads
- Unable to save a plot containing Chinese (two-byte) Characters (PR#9201)
- 【help】why not support showing filename containing chinese characters with the ls function?
- Chinese, Japanese, Korean Tokenizer.
- [LLVMdev] Define Integer to be of 2 Bytes for a Target
- [Bug 2477] New: backspace in interactive session does not delete multi-byte Unicode characters correctly