bugGNU Octave - Bugs: bug #55612, Characters not encoded in UTF-8...

 
 

bug #55612: Characters not encoded in UTF-8 when printing to .svg

Submitter:  Markus Mützel <mmuetzel>
Submitted:  Thu 31 Jan 2019 07:31:05 AM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 5.0.90 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 31 Jan 2019 08:37:59 PM UTC, comment #7: 

Thanks for building so fast :-). I pushed the patch here:

http://hg.savannah.gnu.org/hgweb/octave/rev/903c9a39e051

Closing report as fixed.

Pantxo Diribarne <pantxo>
Group Member
Thu 31 Jan 2019 07:24:57 PM UTC, comment #6: 

I cross-compiled hg id 46fa64c0ae40 with your patch, made the change from your comment #1 and ran these commands:

title ('é \delta');
print no_convert.svg
print -svgconvert convert.svg
print -dpdfcrop -svgconvert convert.pdf


The results on screen and in the files match.
Thanks for the quick fix.

(file #46144, file #46145, file #46146)

Markus Mützel <mmuetzel>
Group administrator
Thu 31 Jan 2019 10:21:38 AM UTC, comment #5: 

I attached a tentative patch, not sure this will do the trick.

(file #46142)

Pantxo Diribarne <pantxo>
Group Member
Thu 31 Jan 2019 09:48:28 AM UTC, comment #4: 

Printing to .pdf seems to work correctly. Please, see the attached file.

(file #46141)

Markus Mützel <mmuetzel>
Group administrator
Thu 31 Jan 2019 09:42:48 AM UTC, comment #3: 

Thanks. Could you try to print to pdf and see if printing non ascii characters is also broken:


title ('é \delta');
print -dpdfcrop -svgconvert convert.pdf


Pantxo Diribarne <pantxo>
Group Member
Thu 31 Jan 2019 09:20:25 AM UTC, comment #2: 

Attached are the two files.
Like you already expected, the first is UTF-8 encoded and the latter is in Latin-1.

(file #46139, file #46140)

Markus Mützel <mmuetzel>
Group administrator
Thu 31 Jan 2019 08:49:56 AM UTC, comment #1: 

@Markus: I tried to set my locale to fr_FR.iso88591 on linux but this still worked so I'll need you to test things on Windows. First we need to determine if the svgconvert utility is responsible for breaking the encoding. Could you generate an svg straight from gl2ps? You'll just need to do the change below in _print_parse_opts_.m:


--- a/scripts/plot/util/private/__print_parse_opts__.m  Sun Jan 27 19:01:50 2019 +0100
+++ b/scripts/plot/util/private/__print_parse_opts__.m  Thu Jan 31 09:32:53 2019 +0100
@@ -212,7 +212,7 @@

   ## By default, postprocess svg files using svgconvert.
   if (strcmp (arg_st.devopt, "svg"))
-    arg_st.svgconvert = true;
+    ## arg_st.svgconvert = true;
   endif


Then


title ('é');
print no_convert.svg
print -svgconvert convert.svg


Is no_convert.svg also broken? If not, can you attach both files.

Pantxo Diribarne <pantxo>
Group Member
Thu 31 Jan 2019 07:31:05 AM UTC, original submission:  

As reported on the mailing list by Chris Zheng[1]:
With version 4.4.1, the following code

title('é');
print n.svg


results in garbage content in the figure window, but the right content in the SVG file. However with version 5.0.90 downloaded from [2], the above code results in right content on the screen but wrong content in the SVG file (the wrong content is encoded in GBK which is my locale encoding).


I can confirm what was described with the 5.0.90 build on Windows 10: The strings in the .svg should be UTF-8 encoded. But they seem to be encoded in Latin-1 (which is my locale encoding).

[1]: http://octave.1599824.n4.nabble.com/Encoding-in-Octave-5-0-td4691184.html
[2]: ftp://alpha.gnu.org/gnu/octave/

Markus Mützel <mmuetzel>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #46144:  convert.svg added by mmuetzel (6KiB - image/svg+xml)
file #46145:  no_convert.svg added by mmuetzel (6KiB - image/svg+xml)
file #46146:  convert.pdf added by mmuetzel (5KiB - application/pdf)
file #46142:  svg_utf8.patch added by pantxo (1KiB - text/x-patch)
file #46141:  convert.pdf added by mmuetzel (5KiB - application/pdf)
file #46139:  no_convert.svg added by mmuetzel (6KiB - image/svg+xml)
file #46140:  convert.svg added by mmuetzel (6KiB - image/svg+xml)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by mmuetzel (Submitted the item)
  • -email is unavailable- added by mmuetzel
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-01-31 pantxo StatusPatch Reviewed Fixed
        Open/ClosedOpen Closed
    2019-01-31 mmuetzel Attached File- Added convert.svg, #46144
        Attached File- Added no_convert.svg, #46145
        Attached File- Added convert.pdf, #46146
        StatusConfirmed Patch Reviewed
    2019-01-31 pantxo Attached File- Added svg_utf8.patch, #46142
    2019-01-31 mmuetzel Attached File- Added convert.pdf, #46141
    2019-01-31 mmuetzel Attached File- Added no_convert.svg, #46139
        Attached File- Added convert.svg, #46140
    2019-01-31 mmuetzel Carbon-Copy- Added pantxo

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code