issue-#182 fixing code page conversion in RTF import

Re: issue-#86 improvements in RTF import

Postby Ivan Denisov » Fri Nov 17, 2017 10:56 pm

Oleg N. Cher found one bug with encoding during RTF import. I am attaching example document.
BlackBox wrong detect CP1252 than it should detect CP1251.
Attachments
encodingBug.rtf
(51.19 KiB) Downloaded 132 times
Ivan Denisov
 
Posts: 1698
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#86 improvements in RTF import

Postby Ivan Denisov » Fri Nov 17, 2017 11:32 pm

I found fix which solves the problem.
The tag \ansicpg should be parsed correctly to set default font codePage.
Also Unicode was written incorrectly. It should not be encoded (should be written directly).
Attachments
TextConv.odc.zip
(11.18 KiB) Downloaded 120 times
Ivan Denisov
 
Posts: 1698
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#86 improvements in RTF import

Postby Zinn » Sun Nov 19, 2017 7:26 am

In StdCoded text below is the minimized necessary change (adding the green line) to solve the problem:
- Helmut
StdCoder.Decode ..,, ..an....3Qw7uP5PRPPNR9Rbf9b8R79FTvMf1GomCrlAy2xhX,Cb2x
hXhC6FU1xhiZiVBhihgmRiioedhgrZcZRiXFfaqmSrtuGfa4700zdGrr8rmCLLCJuyKtYcZRiX
7.2.s,sON.,k,5TWyql.bnayKmKKqGomC5XzET1.PuP.MHT9N9ntumaU2,CJuyKtQC98P9PP7O
NbXmb.2.Ar9k2kMj.,6.,U08J99SdfJHPNjvQCJuGKfaqmY6MwdONl1QCh0708T,U..w.Qf9U.
2U18J99SqorGqmQCbWBxhYFWUl1UnNHEWUmr.6.ov7k5Efb.,6.,.5O,cU.ktAcoZimBhWhioh
gnZcZRCY.2.Q42U.EBU.U,U.I3l6w1.0E65.w26.6ixg.0sR8U0Cy2hgqRcjhhhBgiZgZJinpZ
HZCh0E.4TWKKv.Uio8.,cw5.0.,,,.B.0UJUv.,.l3Umr,6.222.o.6.K,K10E.E6Gz.2kvI.4
zdGLmOormKmCLLOormKmGomCrl.2.CM.61MRE.k.2U1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.11D.n0,6.C66.,.60sD0.,U002..676.16.,6.0.0
mFF.0E.02w92.4.0E.cUqU.E..UO.,.1.eG..2UEC.6..mEw7169rwKiEw3c0Cy2xBq4sE..M4
E..U6U.k.Y,0E.0ohC5ngc0MyfU.aT0QjWa.anL0ud,...
--- end of encoding ---
Last edited by Zinn on Tue Nov 21, 2017 11:17 pm, edited 1 time in total.
Zinn
 
Posts: 472
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main

Re: issue-#86 improvements in RTF import

Postby Josef Templ » Tue Nov 21, 2017 10:38 pm

As far as I see, this has nothing to do with issue-#86, has it?
New improvements or bug fixes should be treated in a new issue.
Can anybody explain what the findings are about?
Is this an issue with exporting RTF or importing it?

- Josef
User avatar
Josef Templ
 
Posts: 2038
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#86 improvements in RTF import

Postby Zinn » Tue Nov 21, 2017 11:01 pm

Just download the file "encodingBug.rtf" on the last page above and load it to BlackBox.
Part of the text is unreadable. After adding the changes from last page and load this file the text is readable completely.
In StdCoded text below is the minimized necessary change (adding the green line).
- Helmut
StdCoder.Decode ..,, ..an....3Qw7uP5PRPPNR9Rbf9b8R79FTvMf1GomCrlAy2xhX,Cb2x
hXhC6FU1xhiZiVBhihgmRiioedhgrZcZRiXFfaqmSrtuGfa4700zdGrr8rmCLLCJuyKtYcZRiX
7.2.s,sON.,k,5TWyql.bnayKmKKqGomC5XzET1.PuP.MHT9N9ntumaU2,CJuyKtQC98P9PP7O
NbXmb.2.Ar9k2kMj.,6.,U08J99SdfJHPNjvQCJuGKfaqmY6MwdONl1QCh0708T,U..w.Qf9U.
2U18J99SqorGqmQCbWBxhYFWUl1UnNHEWUmr.6.ov7k5Efb.,6.,.5O,cU.ktAcoZimBhWhioh
gnZcZRCY.2.Q42U.EBU.U,U.I3l6w1.0E65.w26.6ixg.0sR8U0Cy2hgqRcjhhhBgiZgZJinpZ
HZCh0E.4TWKKv.Uio8.,cw5.0.,,,.B.0UJUv.,.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Zh2hgnRg.ASW5.ELCoruKu.GYnRg.sEMMgA.Z1...b
f9.EWE.8T0E.E82.,.HE.0U..U,IEX.0.11D.n0,6.C66.,.60sD0.,U002..676.16.,6.0.0
mFF.0E.02w92.4.0E.cUqU.E..UO.,.1.eG..2UEC.6..mEw7169rwKiEw3c0Cy2xBq4sE..M4
E..U6U.k.Y,0E.0ohC5ngc0MyfU.aT0QjWa.anL0ud,...
--- end of encoding ---
Zinn
 
Posts: 472
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main

Re: issue-#86 improvements in RTF import

Postby Josef Templ » Tue Nov 21, 2017 11:23 pm

Zinn wrote:Just download the file "encodingBug.rtf" on the last page above and load it to BlackBox.
Part of the text is unreadable. After adding the changes from last page and load this file the text is readable completely.


There is exactly the same behavior when opening the file "encodingBug.rtf" with Wordpad or OpenOffice.
If this is a bug in BlackBox it must be the same bug everywhere.

- Josef
User avatar
Josef Templ
 
Posts: 2038
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#86 improvements in RTF import

Postby Zinn » Tue Nov 21, 2017 11:33 pm

Without the change the first line is unreadable and looks like
Íà Îáåðîíå ñ êîìôîðòîì,
With the change the first line is readable and looks like
На Обероне с комфортом,
LibreOffice Writer displays this sample readable.
Zinn
 
Posts: 472
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main

Re: issue-#86 improvements in RTF import

Postby Josef Templ » Tue Nov 21, 2017 11:38 pm

Thanks, I see. What BlackBox shows is not Cyrillic but undefined.

- Josef
User avatar
Josef Templ
 
Posts: 2038
Joined: Tue Sep 17, 2013 6:50 am

issue-#182 fixing code page conversion in RTF import

Postby Josef Templ » Wed Nov 22, 2017 12:09 am

According to the bug report in https://forum.blackboxframework.org/viewtopic.php?f=50&t=324&start=10#p6642 by Ivan on behalf of Oleg N. Cher
I have created issue https://redmine.blackboxframework.org/issues/182.

The bug fix proposed by Ivan looks good.
It essentially handles the parameter of the \ansicpg command, which was ignored so far.
The code page specified by this command is used for conversion of the extended ascii characters.

Just one question: can't "PROCEDURE WriteUnicode" be slightly simplified?
It is only used for writing a Unicode character in a \u command. Why does it need Windows character conversion?
I have tried to simplify it. Please let me know if it is too simple now.

- Josef

Edit by Robert: Link to bug report above is now obsolete as the bug report has been moved to the start of this topic.
User avatar
Josef Templ
 
Posts: 2038
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#182 fixing code page conversion in RTF import

Postby Zinn » Wed Nov 22, 2017 6:51 am

Josef Templ wrote:Just one question: can't "PROCEDURE WriteUnicode" be slightly simplified?
- Josef

Yes, it can be deleted. WriteUnicode is a part copy of Write. You don't need WriteUnicode. Just use Write instead,
- Helmut
Zinn
 
Posts: 472
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main

Next

Return to Resolved (Bugs)

Who is online

Users browsing this forum: No registered users and 1 guest

cron