Bug 122876

Summary: switching to kjots 0.7 deleted all umlauts and directly following letters from books and pages
Product: [Unmaintained] kjots Reporter: Janet <bugzilla>
Component: generalAssignee: Jaison Lee <lee.jaison>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 0.7   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Janet 2006-03-01 01:31:32 UTC
Version:           0.7 (using KDE KDE 3.5.1)
Installed from:    Debian testing/unstable Packages
Compiler:          Target: i486-linux-gnu 
OS:                Linux

With switching from kjots 0.6 to kjots 0.7 all my books were converted to a new file format (without any interaction, without any notification).

And now all german umlauts and all letters that follow directly to an umlaut in the converted books are gone - that will take some hours to fix it.

I have some more installations where I now need to switch to kjots 0.7 (because of the other book format - if you update one installation you need to update all in reach). How can I handle the umlauts problem? Is there a way to convert the old book files to the new book files without loosing the umlauts and the directly following other letter? In the options I can now tell kjots to use unicode. But that doesn't bring back the missing letters.
Comment 1 Jaison Lee 2006-03-01 06:02:54 UTC
I see what you mean, but strangely the problem doesn't seem to happen during the conversion; everything looks fine at first, but after the page is redisplayed it stops showing characters with diacritics correctly. It looks like it is just a display problem, as all the data remains in tact in the file. So long as you haven't done anything to alter the file data, all the data is stored in the .book file just fine. 

A temporary workaround to get up and running on the new version would be to open the .book with kedit or something, copy the data out, then open up KJots and turn on Unicode and paste the data back in. If you have already done something to alter the data and cause a save then it may not save correctly. That happened once while I was playing around just now. (I'm not sure precisely what I did to cause it, usully the data is just fine.)

The above method should work for getting the data back into the old version as well. I'm sorry but the file formats between the KJots in KDE3.4 and KDE3.5 are simply not cross-compatible. You will need to pick one version or the other to use.

I'm sorry you had problems, but the initial time the data is displayed it looks OK, which is undoubtably why this problem persisted. Only after redisplaying the data does the encoding problem become visually apparent. I'm sure this is just an encoding issue somewhere, I just can't figure out where just now. :(

Comment 2 Janet 2006-03-02 03:02:23 UTC
Luckily I have a current backup of my kjots 0.6 books so I can copypaste all pages into kjots 0.7. That's easier than using the converted bookfiles to do it. And as I have seen just now the converted bookfiles now also miss the mentioned characters. Maybe because I tried to save. Would have been nice to have been warned on the first run of the new version that the program is now going to convert the books to another format and that it might be wise to update the old books first. Do you plan to keep this format or will there be another change with KDE 4?  

Well - and even if it might not look like it: I appreciate the work you have done with kjots :)
Comment 3 Jaison Lee 2006-03-02 05:06:23 UTC
>Do you plan to keep this format or will there be another change with KDE 4?   

The new XML format will give KJots all the growth it needs forever. There will definately be new elements added as the feature list grows, but I can't imagine needing to change to something other than XML. 

Comment 4 Jaison Lee 2006-03-04 05:21:54 UTC
SVN commit 515542 by jlee:

BUG:122876
Encoding is not being stored correctly in the XML. For now, use a
QTextStream to read it in properly.



 M  +5 -1      kjotsentry.cpp  


--- branches/KDE/3.5/kdeutils/kjots/kjotsentry.cpp #515541:515542
@@ -306,8 +306,12 @@
     
             if ( file.exists() && file.open(IO_ReadWrite) ) //TODO: Implement read-only mode?
             {
+                QTextStream st(static_cast<QIODevice*>(&file));
+                st.setEncoding(  KJotsSettings::unicode() ? QTextStream::UnicodeUTF8 : QTextStream::Locale );
+                QString data = st.read();
+
                 QDomDocument doc( "KJots" );
-                if ( doc.setContent( &file ) ) 
+                if ( doc.setContent( data ) ) 
                 {
                     QDomElement docElem = doc.documentElement();