Bug 72036 - GraphicExportFilter mangles asian characters in headless mode
Summary: GraphicExportFilter mangles asian characters in headless mode
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
(earliest affected) release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
Depends on:
Blocks: Graphics-Export
  Show dependency treegraph
Reported: 2013-11-26 14:09 UTC by Maxim
Modified: 2023-08-13 03:20 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:

Python script (1009 bytes, text/plain)
2013-11-26 14:09 UTC, Maxim
Source doc (15.73 KB, application/vnd.oasis.opendocument.graphics)
2013-11-26 14:10 UTC, Maxim
Result 1 (65.26 KB, image/png)
2013-11-26 14:11 UTC, Maxim
Result 2 (17.33 KB, image/png)
2013-11-26 14:12 UTC, Maxim

Note You need to log in before you can comment on or make changes to this bug.
Description Maxim 2013-11-26 14:09:36 UTC
Created attachment 89838 [details]
Python script

Start libreoffice as following:

$ /usr/bin/libreoffice4.0 "--accept=socket,host=localhost,port=2002;urp;"

draw.odg contains some asian text. Let's export it using using GraphicExportFilter. I created a sample python script for this (drawpages.py):

$ cp draw.odg /tmp/
$ python drawpages.py

Now open /tmp/draw.png. Everything is displayed correctly.

Now start libreoffice in headless mode:

/usr/bin/libreoffice4.0 "--accept=socket,host=localhost,port=2002;urp;" --headless

Repeat steps above. If you open /tmp/draw.png, you will notice that all asian characters are mangled.

For convenience I attached drawpages.py and other documents. For clarity here it is:
import uno

localContext = uno.getComponentContext()
resolver = localContext.ServiceManager.createInstanceWithContext(
        "com.sun.star.bridge.UnoUrlResolver", localContext)

context = resolver.resolve("uno:socket,host=localhost,port=2002;"

desktop = context.ServiceManager.createInstanceWithContext(
        "com.sun.star.frame.Desktop", context)

url = uno.systemPathToFileUrl('/tmp/draw.odg')
doc = desktop.loadComponentFromURL(url, "_blank", 0, ())

draw_pages = doc.getDrawPages()
page = draw_pages.getByIndex(0)

gf = context.ServiceManager.createInstanceWithContext(
        "com.sun.star.drawing.GraphicExportFilter", context)

url = uno.systemPathToFileUrl('/tmp/draw.png')
pv1 = uno.createUnoStruct("com.sun.star.beans.PropertyValue")
pv1.Name, pv1.Value = "URL", url

pv2 = uno.createUnoStruct("com.sun.star.beans.PropertyValue")
pv2.Name, pv2.Value = "MediaType", "image/png"

args = (pv1, pv2)

Comment 1 Maxim 2013-11-26 14:10:40 UTC
Created attachment 89839 [details]
Source doc
Comment 2 Maxim 2013-11-26 14:11:48 UTC
Created attachment 89840 [details]
Result 1
Comment 3 Maxim 2013-11-26 14:12:17 UTC
Created attachment 89841 [details]
Result 2
Comment 4 Maxim Monastirsky 2013-11-27 09:21:30 UTC
Why this complicated reproduction steps? I can reproduce it simply with 'libreoffice --headless --invisible --convert-to png draw.odg'.
Comment 5 Maxim Monastirsky 2013-11-27 09:22:50 UTC
Forgot to mention: LO under Ubuntu 13.10 (64-bit).
Comment 6 Maxim 2013-11-27 09:26:10 UTC
(In reply to comment #4)
> Why this complicated reproduction steps? I can reproduce it simply with
> 'libreoffice --headless --invisible --convert-to png draw.odg'.

That's because I discovered this issue by using UNO.
Comment 7 Maxim 2013-11-27 12:45:03 UTC
(In reply to comment #4)
> Why this complicated reproduction steps? I can reproduce it simply with
> 'libreoffice --headless --invisible --convert-to png draw.odg'.

Also note, that when you use `--convert-to` flag it's not clear how LO does conversion.

But in the the script above it is clear that the problem is in a call to GraphicExportFilter.
Comment 8 QA Administrators 2015-04-19 03:23:20 UTC Comment hidden (obsolete)
Comment 9 Buovjaga 2015-06-19 13:10:56 UTC
Still messed up result.

Ubuntu 15.04 64-bit 
Build ID: fb6dd2a73074b9695bd8ddf7ba40f1819b03024e
TinderBox: Linux-rpm_deb-x86_64@46-TDF-dbg, Branch:master, Time: 2015-06-17_23:54:33
Locale: en-US (en_US.UTF-8)
Comment 10 QA Administrators 2016-09-20 10:11:42 UTC Comment hidden (obsolete)
Comment 11 QA Administrators 2021-08-12 03:57:39 UTC Comment hidden (obsolete)
Comment 12 QA Administrators 2023-08-13 03:20:14 UTC
Dear Maxim,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)

If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword

Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team