Skip to content

Unsupported unicode chars #37

@Excustic

Description

@Excustic

Apparently remarkable uses \u2028 and \u2029 as their line separators in some text blocks. This seems to break the svg exporter when trying to append the html output.

  File "D:\Work\remarkable\tests\Lines2InkML\venv\Lib\site-packages\rmc\cli.py", line 137, in convert_rm
    tree_to_svg(tree, fout)
  File "D:\Work\remarkable\tests\Lines2InkML\venv\Lib\site-packages\rmc\exporters\svg.py", line 103, in tree_to_svg
    draw_text(tree.root_text, output)
  File "D:\Work\remarkable\tests\Lines2InkML\venv\Lib\site-packages\rmc\exporters\svg.py", line 291, in draw_text
    output.write(f'\t\t\t<text x="{xx(xpos)}" y="{yy(ypos)}" class="{cls}">{str(p).strip()}</text>\n')
  File "C:\Python312\Lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Quick fix
I am bypassing this error in my forked version by just doing this:

# Translate unsupported unicode chars
content = str(p).replace('\u2028', '<br>').replace('\u2029', '<br>')

But maybe there should be a function that handles and parses correctly all special Unicode characters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions