Tag Info

Hot answers tagged

17

Since a native method is not forthcoming, I shall post my file based circumvention, for Windows. You will need to have this utility in the command path (it apparently is stock with Windows 7). copyUnicode[expr_] := Run["clip <", Export["$Clipboard.temp", ToString[expr, InputForm], "Text", CharacterEncoding -> "Unicode"] ]; Usage: expr ...


11

Declaration: This method for Windows is based on the .NET code from Todd Gayley's this wonderful answer. My .NET knowledge is absolutely ZERO, all credit goes to Todd. Code: The main idea is to extract the "Input"-style code string, convert it to the UTF-16 little endian form, which is the standard byte order in Windows, feed the bytes to system clipboard ...


9

Edit Fixed problem with pasting into textarea In some applications on Mac, copying as Unicode from Mathematica already works without having to do any postprocessing. However, it doesn't work in textarea fields in web browsers. Nevertheless, if you're willing to do a few additional mouse clicks, the Unicode forms can be brought into the browser by taking ...


6

Here's a version that doesn't require a temporary file. Linux (needs xclip) SetAttributes[copyUnicode, HoldAll]; copyUnicode[expr_] := With[{ stream = OpenWrite["!xclip -in -selection clipboard", CharacterEncoding -> "UTF-8"] }, WriteString[stream, ToString[Unevaluated@expr, InputForm]]; Close@stream; ]; Example: executing the cell ...


5

I had started working on a homegrown solution to this issue, directly by downloading Unicode data from the source. I’ll post it here, as it may be expanded to other functions were Java might not come and save the day! unicodeData = StringSplit[#, ";"] & /@ StringSplit[Import["ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt"], "\n"]; ...


4

It seems that the problem can be solved by setting explicit value of the CharacterEncoding global FE option (checked with MMa 8.0.4 and 9.0.0): SetOptions[$FrontEnd, CharacterEncoding -> "UTF8"]; Export["test.pdf", "кириллический текст"] An equivalent way (without changing the global FE settings): Export["test.pdf", Style["кириллический текст", ...


4

The following workaround works at least for Linux with Mathematica version 8.0.0.0; it might work on other systems, too: Step 1: Open a terminal window (with UTF8 encoding) and start directly the kernel there. Step 2: Enter $CharacterEncoding="UTF8" and press Enter. Ideally the kernel would figure that out itself from the locale, but for some reason it ...


3

I found the following workaround for Windows systems. Go to the Control Panel and select Regional & Language Options. Under the Advanced tab select "Greek" as the language for non-Unicode programs. Note that the option to change is not the language for "Standards and Formats". It is the language for non-Unicode programs. Now Greek letters will be ...


2

Hbar asked: What is the logic of the junk ExportString prints into a cell? On my system (Mathematica 7, Windows 7) I don't get quite the same result, but I assume the mechanism is similar. If we use ToCharacterCode to convert our intended string into UTF-8 we get multi-byte encoding: utf8 = ToCharacterCode["Hello \[RightArrow] World!", "UTF8"] ...


1

If the goal is to write latex, why not use "Tex" export which gives nice looking Latex hw = {72, 101, 108, 108, 111, 32, 8594, 32, 87, 111, 114, 108, 100, 33}; str = FromCharacterCode[hw]; ExportString[str, "Tex"] or more simply TeXForm[str] \text{Hello $\rightarrow $ World!}



Only top voted, non community-wiki answers of a minimum length are eligible