Bug 81461 - FILEOPEN: FB2 files encoded in windows-1251 don't open on Windows
Summary: FILEOPEN: FB2 files encoded in windows-1251 don't open on Windows
Status: RESOLVED DUPLICATE of bug 63756
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.2.5.2 release
Hardware: Other Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: BSA
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-17 11:54 UTC by ya.buldozer
Modified: 2014-07-20 08:28 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
The attached file to check stored in different encodings (499.03 KB, application/zip)
2014-07-17 11:54 UTC, ya.buldozer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ya.buldozer 2014-07-17 11:54:08 UTC
Created attachment 102980 [details]
The attached file to check stored in different encodings

Sorry for English, I write with the help of Google Translator.
Problem Description: 
LibreOffice installed in windows 7 when opening a document stored in FB2 encoding windows-1251 with help of the dialog box "open with" just opens it as text without formatting. And if you open through global menu, selecting the file type FB2, it goes IO error. And when you open a saved document FB2-encoded UTF-8 BOM opens properly formatted. In ubuntu 14.04 opens correctly in both encodings. 
Prboval release 4.3.0.2, the same behavior.

Steps to reproduce: 
1 Open LibreOffice global menu and select to open the file. 
2 File type expression "all files" and open FB2 document saved in windows-1251 encoding, (if you select the file type FB2 an error IO).
3 Or right-click on the desired file and select open with the writer (Web).

Current behavior: 
comes off as text 
<?xml version="1.0" encoding="windows-1251"?>
<FictionBook xmlns="http://www.gribuser.ru/xml/fictionbook/2.0" xmlns:l="http://www.w3.org/1999/xlink">
 <description>
  <title-info>
   <genre>sf_fantasy</genre>
   <author>
    <first-name>Александр</first-name>
    <last-name>Прозоров</last-name>
   </author>
   <book-title>Медный страж</book-title>
   <annotation>
    <p>Он пришел из нашего мира… Его называли… ВЕДУН!</p>
    <p>Война князя Муромского с торками оказалась на удивление жестокой. После их разгрома для русских торговых людей открылись дороги в верховья реки Урал и, естественно, встреча с шаманами и арийскими магами, с новыми богами и правителями, с неведомыми на Руси народами и обычаями.</p>
    <p>Встретив своего друга купца Любовода, Ведун ожидал найти на борту его ладьи отдых — покачаться на волнах, послушать журчание воды, посмеяться над купеческими побасенками. Знал бы он, что попутный ветер и парус с алым крестом несут его под мечи бессмертных, неуязвимых врагов.</p>

Expected Behavior:
open correctly
Александр Прозоров
Медный страж
Предисловие автора
Среди пустынь и пересохших степей Азии и Ближнего Востока то тут, то там вздымаются руины древних городов: полуобвалившиеся кирпичные стены, ямы безводных арыков и колодцев. Каменные остовы торчат кое-где и в безлесой истоптанной Европе, напоминая современникам о величии сгинувших во тьме времени народов. Но редко удастся заметить что-либо подобное среди густой тайги, что зеленеет на бескрайних просторах Сибири, приуральских равнинах, да и на самом Урале. Леса быстро поглощают оставленные жителями улицы и площади, засыпают валежником рвы и колодцы, дожди превращают деревянные дома и крепости в груды перегноя, который тут же прорастает молодой зеленью. Пройдет два-три столетия, и забредший в бывшее городище охотник и не догадается, переваливая очередной взгорок, что одолевает неприступную твердыню, шагает по оживленному некогда торгу.

              
Operating System: Windows 7
Version: 4.2.5.2 release
Comment 1 David Tardon 2014-07-17 14:10:48 UTC
AFAIK the problem is in libxml2, which only handles a few major encodings internally and uses libiconv for all the others. But we do not bundle libiconv, only libxml2, and libiconv is not generally available on Windows. There are three possible solutions:

1. We bundle libiconv with libreoffice (on Windows only; could even be pre-built, I think)
2. I work-around this in libe-book by converting the input to UTF-8 before passing it to libxml2. This would mean also changing the input, as the encoding is recorded in XML declaration, so I would really like to avoid having to do this. (But it is possible that libxml2 allows to override the encoding recorded in the XML input. Then this would probably be the easiest solution.)
3. (Speculation) There might be a way to "plug" a different encoding converter into libxml2; then I might use ICU which libe-book already depends on anyway.
Comment 2 ya.buldozer 2014-07-18 12:57:49 UTC
(In reply to comment #1)
> AFAIK the problem is in libxml2, which only handles a few major encodings
> internally and uses libiconv for all the others. But we do not bundle
> libiconv, only libxml2, and libiconv is not generally available on Windows.
> There are three possible solutions:
> 
> 1. We bundle libiconv with libreoffice (on Windows only; could even be
> pre-built, I think)
> 2. I work-around this in libe-book by converting the input to UTF-8 before
> passing it to libxml2. This would mean also changing the input, as the
> encoding is recorded in XML declaration, so I would really like to avoid
> having to do this. (But it is possible that libxml2 allows to override the
> encoding recorded in the XML input. Then this would probably be the easiest
> solution.)
> 3. (Speculation) There might be a way to "plug" a different encoding
> converter into libxml2; then I might use ICU which libe-book already depends
> on anyway.

Again sorry for my english
Thank you. I replaced the library catalog on the library libreoffice taken here with this address: http://www.zlatkovic.com/libxml.en.html
All earned.
Comment 3 David Tardon 2014-07-18 13:03:15 UTC
(In reply to comment #1)
> 3. (Speculation) There might be a way to "plug" a different encoding
> converter into libxml2; then I might use ICU which libe-book already depends
> on anyway.

Actually libxml2 can already use ICU instead of libiconv. So all that is needed is to build the bundled libxml2 with ICU support on Windows. This will solve this bug and several others too (bug 63756).
Comment 4 David Tardon 2014-07-20 08:28:55 UTC

*** This bug has been marked as a duplicate of bug 63756 ***