View Single Post
Old 03-06-2012, 12:54 PM   #25
trin_cz
Junior Member
trin_cz began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Mar 2012
Device: PocketBook 611
For fragile or anyone stuck with this problem. Yes, fbreader is very nasty and compresses all spaces, tabs, wide space, utf8 non-breaking space ... simply everything.
But you can fool it with SOFT-HYPHEN ! This is utf8 0x00AD symbol. Even though fbreader doesn't display it, it treats as non-space. This means that spaces around soft-hyphen are not contracted.

I used this short python script to transform my txt files:
Quote:
import sys
import codecs

text = codecs.open(sys.argv[1],'r','utf-8').read()
#text = unicode(text)
text = text.replace(u' ',u' \u00ad \u00ad')
codecs.open(sys.argv[1],"w",'utf-8-sig').write(text)
After applying this script, the spaces appear as doubled in normal viewer. But in fbreader they look as they are supposed to. Script converts the file in-place (==MAKE BACKUPS!!!).

My problem was with formating songs with chords for guitar playing - fbreader destroyed the formatting. This conversion of txt files solved my problem.

Enjoy!
trin_cz is offline   Reply With Quote