simonhaenisch/md-to-pdf

bug: backslash displaying as a yen symbol

maciek-ibm opened this issue · 4 comments

Context:

  • version (md-to-pdf -v): 5.1.0
  • platform (Unix, macOS, Windows): Linux
  • node version: v14.18.0

Describe the bug:

A clear and concise description of what the bug is. Feel free to include screenshots.

When I create a code block with \, i.e:

Overview

\\ <- this is a backslash

In the PDF I see two Yen characters instead. Please see the screenshot.

Screenshot 2022-08-12 at 17 06 00

On localhost it works fine, but on the production box it doesn't. I checked the DB character encoding and it's the same on both instances.

When I output it to the logs using as_html: true I can see this:
<h1 class="primaryHeader title-element" data-title-level="1" id="title-element-1" data-ref="629c10dc-c4f9-4d05-8bb6-e783d79fd24f" data-id="title-element-1"> Overview\n' + '</h1><hr class="underline" data-ref="b5f074ba-dd65-4f9e-8d71-ff03753ecc6e"> <pre data-ref="b4560c7b-8392-4ff2-a6cb-a11d6bd4792a"><code data-ref="6fd2ab98-adaf-4aec-899f-047975fe0c5e">\\\\ &lt;- this is a backslash\n' +

This also looks correct.

I have md-file-encoding set to default (not providing this arg).

Can anyone help me to find the root cause of this issue?

Not sure but it's most likely a bug with the font you're using to render the code block? You can try changing the font family maybe, e.g.

pre > code {
  font-family: monospace;
}

?

Hi @simonhaenisch Adding this CSS rule unfortunately didn't help. Do you have any other idea what could be wrong?

I have this rule in the CSS:
pre code { background-color: #f8f8f8; padding: 0.1em 0.375em; border-radius: 0.25em; font-family: monospace; font-size: 1.2em; }

Ok have you tried with a different file encoding then? Your editor should tell you the current encoding of your markdown file, maybe make sure it's utf-8? Otherwise no idea, sorry. Also not sure what you mean by "production box", but I guess you could check the system fonts there 🤷🏻‍♂️

Google search gave me this: https://superuser.com/questions/1167662/why-is-windows-10-displaying-as-%C2%A5-on-the-command-line, where one of the answers says "Japanese decided to override backslash code point in ASCII with the yen-sign". Sounds like your "production box" is using a Japanese font maybe.