View Single Post
Old 02-25-2009, 09:18 PM   #5
nsg began at the beginning.
Posts: 20
Karma: 10
Join Date: Nov 2007
Device: PRS-505
D:\>calibre-debug -c "print 'abc'.decode('cp1251')"

BTW, I might have misspelled cp1251. The following line gives error
rtf2lrf --encoding=cp-1251 --keep-intermediate-files z.rtf

But this line does not, but still does not produce readable result.

D:\>rtf2lrf --encoding=cp1251 z.rtf
Converting RTF to XML...
Parsing XML...
Converting XML to HTML...
Traceback (most recent call last):
File "c:\Program Files\calibre\\calibre\customize\" , line 127, in get_file_type_metadata
File "calibre\customize\builtins.pyo", line 68, in get_metadata
File "c:\Program Files\calibre\\calibre\ebooks\lrf\meta. py", line 223, in get_metadata
File "c:\Program Files\calibre\\calibre\ebooks\lrf\meta. py", line 442, in __init__
LRFException: D:\z.rtf has an invalid LRF header. Are you sure it is an LRF file?
Processing u'index.html'
Parsing HTML...
Converting to BBeB...
Rationalizing font sizes...
Output written to D:\z.lrf

z.rtf is a simple rtf file. It consists of 2 lines of Russian alphabet. It is viewable by both WordPad and WordViewer (not sure about MSWord, do not have one). It is really small, I will post it here:

{\rtf1\ansi\ansicpg1251\deff0\deflang1049\deflangf e1049\deftab708{\fonttbl{\f0\fswiss\fprq2\fcharset 204{\*\fname Arial CYR;}Arial;}{\f1\froman\fprq2\fcharset204{\*\fname Times New Roman CYR;}Times New Roman;}{\f2\fmodern\fprq1\fcharset204{\*\fname Courier New CYR;}Courier New;}}
\lang1049\f1\'c0\'c1\'c2\'c3\'c4\'c5\'c6\'c7\'c8\' c9\'ca\'cb\'cc\'cd\'ce\'cf\'d0\'d1\'d2\'d3\'d4\'d5 \'d6\'d7\'d8\'d9\'da\'db\'dc\'dd\'de\'df\par
\'e0\'e1\'e2\'e3\'e4\'e5\'e6\'e7\'e8\'e9\'ea\'eb\' ec\'ed\'ee\'ef\'f0\'f1\'f2\'f3\'f4\'f5\'f6\'f7\'f8 \'f9\'fa\'fb\'fc\'fd\'fe\'ff\par

Last edited by nsg; 02-25-2009 at 09:21 PM.
nsg is offline   Reply With Quote