The time now is Tue 19 Jan 2021, 13:43
All times are UTC - 4 |
Page 2 of 2 [28 Posts] |
Goto page: Previous 1, 2 |
Author |
Message |
greengeek

Joined: 20 Jul 2010 Posts: 5834 Location: Republic of Novo Zelande
|
Posted: Sat 03 Mar 2018, 18:17 Post subject:
Re: Abiword bug Subject description: 'Save as rtf /doc' corruption |
|
Smithy wrote: | Year upon year, Abiword still has this bug. Currently V 3.1
Sometimes when you save an rtf or doc,(in textmaker) then load it up in Abiword you get this result.
If you drag the mouse across you can actually read the text, but if you try to save the file again it is just as corrupted. | I presumed you already knew how to clear the strange formatting - but in case anyone doesn't know how to clear the particular bug shown in the first post - it is to do with "highlighting" being set by Textmaker and misunderstood by Abiword.
You can get around it by opening in Abiword, highlighting the affected text (ctrl A if it is all affected) then clicking "Format, Font, Highlight color", then ticking "set no highlight color" and resaving. Doesn't improve the incorrect communication between Abiword and Textmaker but does allow the user to get a readable result.
Description |
|
Filesize |
52.05 KB |
Viewed |
416 Time(s) |

|
|
Back to top
|
|
 |
musher0
Joined: 04 Jan 2009 Posts: 15041 Location: Gatineau (Qc), Canada
|
Posted: Sat 03 Mar 2018, 18:18 Post subject:
|
|
Hello, gang.
Smithy wrote: | (...)
I would actually give the limping man a piggyback, but if a grizzly was chasing
us, he might have to hang around shouting loudly or singing some opera to do
the animal's head in, whilst I got a massive tree branch or some honey and
berries or something.
(...) |
For the purists and the nostalgic, some almost completely useless information:
http://www.vcfed.org/forum/showthread.php?15238-MS-Word-5-5-for-DOS-for-FREE-%28legally%29
Quote: | MS Word 5.5 for DOS for FREE (legally) | One could run it under DOSBox, I suppose. When you save your writing in RTF,
it would be the original thing. (Straight from the grizzly's mouth!)
I said "almost completely useless", because this would have value as a test, for
comparing, in an hex editor, a save from Word-5.5 and a save of the same text
from Abiword. Maybe there is a simple unnoticed error in Abiword's RTF save
sub-routine?
BFN.
_________________ musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
|
Back to top
|
|
 |
musher0
Joined: 04 Jan 2009 Posts: 15041 Location: Gatineau (Qc), Canada
|
Posted: Sat 03 Mar 2018, 18:21 Post subject:
Re: Abiword bug Subject description: 'Save as rtf /doc' corruption |
|
greengeek wrote: | Smithy wrote: | Year upon year, Abiword still has this bug. Currently V 3.1
Sometimes when you save an rtf or doc,(in textmaker) then load it up in Abiword you get this result.
If you drag the mouse across you can actually read the text, but if you try to save the file again it is just as corrupted. | I presumed you already knew how to clear the strange formatting - but in case anyone doesn't know how to clear the particular bug shown in the first post - it is to do with "highlighting" being set by Textmaker and misunderstood by Abiword.
You can get around it by opening in Abiword, highlighting the affected text (ctrl A if it is all affected) then clicking "Format, Font, Highlight color", then ticking "set no highlight color" and resaving. Doesn't improve the incorrect communication between Abiword and Textmaker but does allow the user to get a readable result. |
Good to know. Many thanks, greengeek.
_________________ musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
|
Back to top
|
|
 |
greengeek

Joined: 20 Jul 2010 Posts: 5834 Location: Republic of Novo Zelande
|
Posted: Sat 03 Mar 2018, 18:49 Post subject:
|
|
i just had a bit more of a tinker with comparing what Textmaker and Abiword RTF files look like when you open them as text and have made an interesting observation.
Use Textmaker to create a file that contains nothing more than the word "test" then save it as RTF.
If you try to open it with Abiword you should see the issue Smithy pointed out in the first post.
Now right cick that file and "open as text" so you can view it in Geany. At the bottom of the file you should see the word "test" preceeded by a "highlight0" spec. See pic 1 below. Note that there is no backslash following the "highlight" term.
Using Geany add a backslash and also change the number from highlight0 to highlight25 and click "save".
Now use Abiword to open the file and the problem should be gone (at least it is on my system...)
I experimented with various highlight values (highlight0, highlight3, highlight4 etc) and each value (except 0) gave a successful highlight that rendered the text visible. "25" was the one that seemed to remove the highlight completely and give white background.
I don't know if others can duplicate this but this is the behaviour I see on my system. (maybe locale dependent??)
 |
Description |
|
Filesize |
71.95 KB |
Viewed |
401 Time(s) |

|
Description |
|
Filesize |
54.34 KB |
Viewed |
416 Time(s) |

|
|
Back to top
|
|
 |
greengeek

Joined: 20 Jul 2010 Posts: 5834 Location: Republic of Novo Zelande
|
Posted: Sat 03 Mar 2018, 18:56 Post subject:
|
|
I also just tried opening Smithy's test file from page 1 and i can make it readable by opening it as text in Geany and using the search function to automatically replace all occurrences of "highlight0" with "highlight25" then clicking "save"
Did not need to worry about backslashes.
Description |
|
Filesize |
61.13 KB |
Viewed |
396 Time(s) |

|
|
Back to top
|
|
 |
musher0
Joined: 04 Jan 2009 Posts: 15041 Location: Gatineau (Qc), Canada
|
Posted: Sat 03 Mar 2018, 20:23 Post subject:
|
|
Hi guys.
Here is a script that does what greengeek was doing manually above. Basically, an
RTF file has plain text in it, not html or xml code, so it can be parsed easily with a
Bash script.
I think the script is well commented, but if you have questions please ask them.
Also, please test on various RTF you may have, to provide more validations. TIA.
An illustration of the result is attached,using Smithy's test document. Also, the
replaceit utility, in 32-bit or 64-bit version, if you do not have it.
IHTH.
~~~~~~~~~~~~~~~~~
Code: | #!/bin/ash
# abi-highlight-correction.sh # (Store in /opt/local/bin, or
# /root/my-applications/bin, or any "/bin" directory.)
#
# Required:
# replaceit, by P.L. Daniels, at http://www.pldaniels.com/replaceit.
#
# Purpose:
# correct the highlighting bug in abiword.
#
# Usage:
# abi-highlight-correction.sh name-of-document
#
# Note:
# The user should be in the document's directory before running this script.
#
# Credits:
# PuppyLinux forum members Smithy (for the 95 Kb test document) and greengeek
# (for insight into the problem).
#
# Discussion thread:
# http://murga-linux.com/puppy/viewtopic.php?t=112434&start=15
#
# (c) musher0, 2018-03-04.
####
LC_ALL=C # For greater speed. We may need it on large documents.
A="$1"
cp -f "$A" "$A".original # We make a back-up beforehand. Remove if process successful.
n="`grep -c highlight0 "$A"`" # Gives us the number of occurrences
############################### of the expression in the document.
for i in `seq $n`;do
replaceit --input="$A" "highlight0" "highlight25"
# replaceit tends to replace one instance at a time. So, to make
# sure the expresion is entirely replaced, we do as many iterations
# as there are occurrences of the expression.
done
###############################
# Time of process up to this point: ~ 0.83 second. (YMMV)
# Test doc was abiword_bug_test.rtf provided by PuppyLinux
# forum member Smithy.
###############################
LC_ALL="" # Restores the original state of LC_ALL.
# Optional:
# exec abiword "$A"
### 30 ### |
 |
Description |
Replaceit64, courtesy of BarryK, way back when. For now, I would suggest that you install the 32bit pet, and then squish the replaceit executable in /usr/bin with the contents of this zip. Reminder: make replaceit64 executable.
|

Download |
Filename |
replaceit64.zip |
Filesize |
7.1 KB |
Downloaded |
194 Time(s) |
Description |
32-bit version
|

Download |
Filename |
replaceit-1.0.0.pet |
Filesize |
7.54 KB |
Downloaded |
273 Time(s) |
Description |
Scipt above, zipped. Unzip in a "/bin" directory and make executable, so it will be in your $PATH.
|

Download |
Filename |
abi-highlight-correction.zip |
Filesize |
988 Bytes |
Downloaded |
196 Time(s) |
Description |
|
Filesize |
227.23 KB |
Viewed |
408 Time(s) |

|
_________________ musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
|
Back to top
|
|
 |
Smithy

Joined: 12 Dec 2011 Posts: 1157
|
Posted: Sun 04 Mar 2018, 09:57 Post subject:
|
|
Ah, is that what it was? Well done Sherlock Holmes and Watson.
So if one clicks on a 'faulty' .rtf file, and docs sometimes, will it just load it up properly or am I jumping the gun a bit.
|
Back to top
|
|
 |
greengeek

Joined: 20 Jul 2010 Posts: 5834 Location: Republic of Novo Zelande
|
Posted: Sun 04 Mar 2018, 14:05 Post subject:
|
|
Smithy wrote: | So if one clicks on a 'faulty' .rtf file, and docs sometimes, will it just load it up properly or am I jumping the gun a bit. | When you find a faulty file you could run musher's script against it to change the "highlight" variables, or you could do it manually using Geany or similar.
The downside of changing all of the "highlight" variables to white color is that you may be losing some genuinely important "highlights" - eg there may be some fluoro green highlights that someone has used to make certain text stand out. Or red highlighting to indicate safety concerns etc.
It may not always be appropriate to ignore the original highlights.
The background to this issue seems to be that for at least the last decade there has been disagreement about how to define highlighted text. Apparently MSWord2003 did not even have full highlight abilities, but MSWord2010 does, so the spec has been changing over time,
There was also disagreement about whether or not "background color" and "shading" and "highlight" were the same thing or different. The consensus in the end was that they are different things and have to be handled differently. It is not surprising that the result is confusion between non-MS word processors.
Here is an example of the bug tracking that has resulted from the confusion: https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/295014
and this is worth a full read too: https://bz.apache.org/ooo/show_bug.cgi?id=24317
I suspect that these highlight misunderstandings will always affect us no matter which alternative WP software we use. Most of the bug reports relate to .doc format but obviously RTF is similarly affected.
Perhaps the best approach is exactly what Abiword has done - to provide a means to turn highlight on or off using the tickbox using the menu: Format/Font/Highlight/SetNoHighlightColor. That way you could view an affected file without changing the existing highlights permanently.
.
Last edited by greengeek on Sun 04 Mar 2018, 14:21; edited 3 times in total
|
Back to top
|
|
 |
musher0
Joined: 04 Jan 2009 Posts: 15041 Location: Gatineau (Qc), Canada
|
Posted: Sun 04 Mar 2018, 14:09 Post subject:
|
|
Smithy wrote: | Ah, is that what it was? Well done Sherlock Holmes and Watson.
So if one clicks on a 'faulty' .rtf file, and docs sometimes, will it just load it up properly or am I jumping the gun a bit. |
Hi Smithy.
If you have a faulty RTF, you have to run the above script beforehand, or do the
change manually from within Abiword as greengeek explained.
Now, no divination is involved; you have to load an RTF file in Abiword to know if
it is faulty according to Abiword. (If this sentence sounds like a truism, then it is!)
Also only RTF documents, no DOCs. *.doc documents are another can of worms,
I will not try to script anything for faulty *.doc documents in Abiword. Greengeek's
approach will probably work, though.
Have a great Sunday!
BFN.
_________________ musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
|
Back to top
|
|
 |
musher0
Joined: 04 Jan 2009 Posts: 15041 Location: Gatineau (Qc), Canada
|
Posted: Sun 04 Mar 2018, 14:18 Post subject:
|
|
@greengeek
There's good research in your post above. Thanks.
_________________ musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
|
Back to top
|
|
 |
greengeek

Joined: 20 Jul 2010 Posts: 5834 Location: Republic of Novo Zelande
|
Posted: Sun 04 Mar 2018, 14:29 Post subject:
|
|
Clever script musher - i had no idea i even had replaceit in my puppy but it's already there so the script worked fine.
I did not stick it in my PATH I just left it in the downloads directory along with Smithy's affected file and ran the following in a terminal:
Code: | ./abi-highlight-correction.sh abiwordbugtest |
Can I suggest an improvement? Maybe consider copying the file as a slightly different name leaving the original file intact?
cheers!
|
Back to top
|
|
 |
greengeek

Joined: 20 Jul 2010 Posts: 5834 Location: Republic of Novo Zelande
|
Posted: Mon 05 Mar 2018, 05:07 Post subject:
|
|
This webpage offers some basic examples of how RTF handles highlight:
http://www.pindari.com/rtf2.html
One example on offer is this:
Code: | {\rtf1\ansi\deff0 {\fonttbl {\f0 Courier;}{\f1 ProFontWindows;}}
{\colortbl;\red0\green0\blue0;\red255\green0\blue0;\red255\green255\blue0;}
This line is font 0 which is courier\line
\f1
This line is font 1\line
\f0
This line is font 0 again\line
This line has a \cf2 red \cf1 word\line
\highlight3 while this line has a \cf2 red \cf1 word and is highlighted in yellow\highlight0\line
Finally, back to the default color.\line
} |
If you paste that into Geany and save as test.rtf Abiword fails to display the last line correctly - giving the same blackout as in Smithy's example. (But only the last line). (See pic 1)
If you then add highlight25 to the beginning of the last line it starts to display correctly. (see pic 2)
Code: | \highlight25 Finally, back to the default color.\line
} |
Maybe it genuinely is an Abiword bug? Or is the RTF spec just not well enough defined?
Description |
|
Filesize |
18.14 KB |
Viewed |
310 Time(s) |

|
Description |
|
Filesize |
43.27 KB |
Viewed |
310 Time(s) |

|
|
Back to top
|
|
 |
musher0
Joined: 04 Jan 2009 Posts: 15041 Location: Gatineau (Qc), Canada
|
Posted: Mon 12 Mar 2018, 10:07 Post subject:
|
|
Hello greengeek.
That should not be a problem if one uses the script to replace all "highlight0" expressions
with "highlight25" expressions.
ONLY "highlight0" expressions are changed -- not "highlight14" or "highlight7"
expressions--, so the other highlighting is not disturbed.
ALL "highlight0" expressions -- anywhere in the RTF document : at the top, in the middle
or at the very end, -- are changed.
I hope this answers your question.
BFN.
_________________ musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
|
Back to top
|
|
 |
|
Page 2 of 2 [28 Posts] |
Goto page: Previous 1, 2 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|