Cyrillic Encoding
Author
John Fultz, Eric Bynum
Title
Cyrillic Encoding
Description
Notebooks created using eastern European keyboards on a Windows machine in versions of Mathematica prior to 4.1 will not display properly in Mathematica 4.1. The problem exists because of the character encodings that were used in earlier versions of Mathematica. This notebook defines a function which will convert the old notebook encodings over to the new format. Be aware that the converted notebooks will not run correctly in Mathematica 4.0 or earlier.
Category
Working Material
Keywords
URL
http://www.notebookarchive.org/2018-10-10r9390/
DOI
https://notebookarchive.org/2018-10-10r9390
Date Added
2018-10-02
Date Last Modified
2018-10-02
File Size
8.93 kilobytes
Supplements
Rights
Redistribution rights reserved




Cyrillic encoding
Cyrillic encoding
Summary
Summary
Notebooks created using eastern European keyboards on a Windows machine in versions of Mathematica prior to 4.1 will not display properly in Mathematica 4.1. The problem exists because of the character encodings that were used in earlier versions of Mathematica. This notebook defines a function which will convert the old notebook encodings over to the new format. Be aware that the converted notebooks will not run correctly in Mathematica 4.0 or earlier.
The functions
The functions
First you need to evaluate the following cell.
In[]:=
ReencodeCharacter[c_String,oldEncoding_String,newEncoding_String]:=Module[{oldEncodeChar=ToCharacterCode[c,oldEncoding]},If[oldEncodeChar==={None},c,FromCharacterCode[oldEncodeChar,newEncoding]]];SetAttributes[ReencodeCharacter,Listable];ReencodeString[str_String,oldEncoding_String,newEncoding_String]:=StringJoin[ReencodeCharacter[Characters[str],oldEncoding,newEncoding]];ReencodeNotebook[fname_String,oldEncoding_String,newEncoding_String]:=Module[{nb=Get[fname]},RenameFile[fname,fname<>".orig"];nb=nb/.{x_String->ReencodeString[x,oldEncoding,newEncoding]};Put[nb,fname];fname];
Using the function
Using the function
In a Mathematica session with no files open, run the following command in an untitled notebook:
ReencodeNotebook["filename", "WindowsANSI", "WindowsCyrillic"]
where "filename" is the *fully qualified* pathname to the notebook. The program will leave the original version of the notebook in "filename.orig", and write the newly encoded notebook to "filename". (You can use the menu command Input/GetFilePath to fill the first argument.)
ReencodeNotebook["filename", "WindowsANSI", "WindowsCyrillic"]
where "filename" is the *fully qualified* pathname to the notebook. The program will leave the original version of the notebook in "filename.orig", and write the newly encoded notebook to "filename". (You can use the menu command Input/GetFilePath to fill the first argument.)


Cite this as: John Fultz, Eric Bynum, "Cyrillic Encoding" from the Notebook Archive (2002), https://notebookarchive.org/2018-10-10r9390

Download

