Bug 62903

Summary: Can't import an RTF file
Product: kword Reporter: Tamas Szanto <tszanto>
Component: filtersAssignee: Ariya Hidayat <ariya>
Status: RESOLVED FIXED    
Severity: normal CC: nicolasg
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: RTF file produced by Crystal Report

Description Tamas Szanto 2003-08-18 20:03:30 UTC
Version:           1.2.92 (using KDE KDE 3.1.3)
Installed from:    Unlisted Binary Package
OS:          Linux

An RTF document produced by our help desk system can't be imported: 
Tag mismatch, line 756, column 15

The file probably contains nesting errors, but OO 1.0 and Word 2000 can still open the document, so KWord should do that as well. I can send the RTF file if a developer needs it.
Comment 1 Nicolas Goutte 2003-08-22 15:32:04 UTC
If you can make that file public, please attach it to this bug report. If you 
cannot could you please make a small test file having the same problem. 
 
Have a nice day! 
Comment 2 Tamas Szanto 2003-08-22 22:22:19 UTC
Created attachment 2295 [details]
RTF file produced by Crystal Report

It's a very shitty RTF file produced by Crystal Reports, probably contains
nesting errors, but MS Word and OO can open it, so KWord should be able to do
that too. Similar files may occur in many places.
Comment 3 Nicolas Goutte 2003-08-22 23:52:24 UTC
Subject: Can't import an RTF file

The nesting problem is only the result of the RTF import filter. It is Qt that 
complains that it is not right XML. And KWord displays Qt's complaint.

The problem is that this RTF file is not 7bit clean, as RTF should be 
normally. The accented character are directly in the text and not escaped. 
The RTF import filter was not made for this and therefore put out garbage.
(In fact non-UTF-8 characters in a UTF-8 XML file. Qt returns an error that is 
misleading.)

However, I have made a hack for KOffice 1.3.

Have a nice day!

Comment 4 Nicolas Goutte 2003-08-22 23:55:28 UTC
Subject: koffice/filters/kword/rtf/import

CVS commit by goutte: 

Add support for non-7-bit-clean files.

Reason: the import filter copied 1:1 non UTF-8 characters in the output file.

WARNING: this is more a hack, as it is not in line with the logic of the 
code of the RTF import filter. However, I think that it is good enough for
KOffice 1.3.
CCMAIL:62903-close@bugs.kde.org


  M +17 -3     rtfimport.cpp   1.56
  M +19 -25    rtfimport_dom.cpp   1.6
  M +3 -1      rtfimport_dom.h   1.4