Skip to content

github files don't support emojies because it uses Base64 decoder that does not support it #5255

@JensLincke

Description

@JensLincke

Preflight Checklist

  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for a feature request that matches the one I want to file, without success.

You must search the issue tracker and agree to the code of conduct. You must fill in this entire template. If you delete part/all or miss parts out your issue will be closed.

If you are technical, you should report bugs along the lines of https://marker.io/blog/how-to-write-bug-report. If you are not technical, we will make allowances, please try to make an effort to understand the process.

Describe the bug
A clear and concise description of what the bug is.

Saving and Loading drawio via github that contains emoji utf-8 unicode characters does not work, because it uses Base64 decode

To Reproduce
Steps to reproduce the behavior:

  1. Try to load a file like:
<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36" version="28.1.2">
  <diagram name="Page-1" id="dGOvtMlQaf0YHdEt--z6">
    <mxGraphModel dx="1500" dy="915" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="3000" pageHeight="1000" math="0" shadow="0">
      <root>
        <mxCell id="0" />
        <mxCell id="1" parent="0" />
        <mxCell id="MyRaAgb93ffFDz9J31C7-1" value="Text&amp;nbsp;👨‍" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
          <mxGeometry x="170" y="170" width="60" height="30" as="geometry" />
        </mxCell>
      </root>
    </mxGraphModel>
  </diagram>
</mxfile>

Reproduce it on a library level

// base64 encoded file
var content = 'PG14ZmlsZSBob3N0PSJhcHAuZGlhZ3JhbXMubmV0IiBhZ2VudD0iTW96aWxs\nYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV2luNjQ7IHg2NCkgQXBwbGVXZWJL\naXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgQ2hyb21lLzEzOS4wLjAu\nMCBTYWZhcmkvNTM3LjM2IiB2ZXJzaW9uPSIyOC4xLjIiPgogIDxkaWFncmFt\nIG5hbWU9IlBhZ2UtMSIgaWQ9ImRHT3Z0TWxRYWYwWUhkRXQtLXo2Ij4KICAg\nIDxteEdyYXBoTW9kZWwgZHg9IjE1MDAiIGR5PSI5MTUiIGdyaWQ9IjEiIGdy\naWRTaXplPSIxMCIgZ3VpZGVzPSIxIiB0b29sdGlwcz0iMSIgY29ubmVjdD0i\nMSIgYXJyb3dzPSIxIiBmb2xkPSIxIiBwYWdlPSIxIiBwYWdlU2NhbGU9IjEi\nIHBhZ2VXaWR0aD0iMzAwMCIgcGFnZUhlaWdodD0iMTAwMCIgbWF0aD0iMCIg\nc2hhZG93PSIwIj4KICAgICAgPHJvb3Q+CiAgICAgICAgPG14Q2VsbCBpZD0i\nMCIgLz4KICAgICAgICA8bXhDZWxsIGlkPSIxIiBwYXJlbnQ9IjAiIC8+CiAg\nICAgICAgPG14Q2VsbCBpZD0iTXlSYUFnYjkzZmZGRHo5SjMxQzctMSIgdmFs\ndWU9IlRleHQmYW1wO25ic3A78J+RqOKAjSIgc3R5bGU9InRleHQ7aHRtbD0x\nO2FsaWduPWNlbnRlcjt2ZXJ0aWNhbEFsaWduPW1pZGRsZTt3aGl0ZVNwYWNl\nPXdyYXA7cm91bmRlZD0wOyIgdmVydGV4PSIxIiBwYXJlbnQ9IjEiPgogICAg\nICAgICAgPG14R2VvbWV0cnkgeD0iMTcwIiB5PSIxNzAiIHdpZHRoPSI2MCIg\naGVpZ2h0PSIzMCIgYXM9Imdlb21ldHJ5IiAvPgogICAgICAgIDwvbXhDZWxs\nPgogICAgICA8L3Jvb3Q+CiAgICA8L214R3JhcGhNb2RlbD4KICA8L2RpYWdy\nYW0+CjwvbXhmaWxlPgo=\n'

Base64.decode(content)
// produces garbage
<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36" version="28.1.2">
  <diagram name="Page-1" id="dGOvtMlQaf0YHdEt--z6">
    <mxGraphModel dx="1500" dy="915" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="3000" pageHeight="1000" math="0" shadow="0">
      <root>
        <mxCell id="0" />
        <mxCell id="1" parent="0" />
        <mxCell id="MyRaAgb93ffFDz9J31C7-1" value="Text&amp;nbsp;ߑ袀�style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
          <mxGeometry x="170" y="170" width="60" height="30" as="geometry" />
        </mxCell>
      </root>
    </mxGraphModel>
  </diagram>
</mxfile>
*/

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Image

draw.io version (In the Help->About menu of the draw.io editor):

  • draw.io version 28.1.2

Desktop (please complete the following information):

  • OS: widows11
  • Browser chrome
  • Browser Version 139

I tested the problem in incognito/private mode with all browser extensions switched off, write "yes" below:

  • no

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions