Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Win] failed to launch if the file contains some emoji or Chinese characters #133

Open
Karmenzind opened this issue Jan 14, 2024 · 0 comments

Comments

@Karmenzind
Copy link

Karmenzind commented Jan 14, 2024

OS: Windows 11
mlp version: 0.2.52

Some emoji (like ❌) or Chinese characters will cause mlp to crash:
image

image
14:40:04 ❯ mlp TEST.md -p 13333 --no-browser
SERVING -- http://localhost:13333
Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Program Files\Python310\Scripts\mlp.exe\__main__.py", line 7, in <module>
  File "C:\Program Files\Python310\lib\site-packages\markdown_live_preview\__main__.py", line 79, in main
    code = run(_main())
  File "C:\Program Files\Python310\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Program Files\Python310\lib\asyncio\base_events.py", line 649, in run_until_complete
    return future.result()
  File "C:\Program Files\Python310\lib\site-packages\markdown_live_preview\__main__.py", line 73, in _main
    await serve()
  File "C:\Program Files\Python310\lib\site-packages\markdown_live_preview\server\server.py", line 129, in start
    await broadcast()
  File "C:\Program Files\Python310\lib\site-packages\markdown_live_preview\server\server.py", line 108, in broadcast
    async for p in gen:
  File "C:\Program Files\Python310\lib\site-packages\markdown_live_preview\__main__.py", line 50, in gen
    md = path.read_text()
  File "C:\Program Files\Python310\lib\pathlib.py", line 1135, in read_text
    return f.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0x8c in position 12: illegal multibyte sequence

But not all emojis do:
image

And mlp cannot display Chinese correctly:
image

@Karmenzind Karmenzind changed the title [Win] failed to launch if the file contains some emojis [Win] failed to launch if the file contains some emoji or Chinese characters Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant