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

Issue with formatting Unicode characters #38

Open
nikkehtine opened this issue Mar 27, 2023 · 5 comments
Open

Issue with formatting Unicode characters #38

nikkehtine opened this issue Mar 27, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@nikkehtine
Copy link
Member

obraz

The correctly displayed word should be Jägermeister

Software

  • Firefox 111.0.1
  • Windows 10

I was unable to determine if the issue occurs on other browsers and devices, it's hard to track and debug it given the randomized nature.

@nikkehtine nikkehtine added the bug Something isn't working label Mar 27, 2023
@car2t
Copy link
Contributor

car2t commented Mar 27, 2023

Hi @nikkehtine

You got a eagle eye Nikki! ;D

I edit the HTML directly in Firefox to add that German word in the span content and I saw it perfectly, so no sure.

Could set the lang attribute in the paragraph to undefined help with that?

<p lang="">...</p>

What do you think?

@WitchDevelops
Copy link
Member

  1. StackOverflow says UTF-8 should fix that (but we're already using it).

Another encoding they suggest is ISO-8859-1.

  1. Another solution I found says to add this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
however there is no explanation as to why.

  1. Solution #3 says to add this line of code to ensure every rendered page is displayed in UTF-8
<meta charset="UTF-8">
<meta http-equiv="Content-type" content="text/html; charset=UTF-8">

(it was said in a context that form submission can mess up encoding, and since our page isn't static, this may be somewhat relevant. I didn't raed the whole thing tho).

@car2t
Copy link
Contributor

car2t commented Mar 28, 2023

Hi @nikkehtine and @WitchDevelops

We could try the last solution. Using

<meta http-equiv="Content-type" content="text/html; charset=UTF-8">

instead using <meta charset="UTF-8"> and see if it works fine.

If that doesn't work then we could use JavaScript. We can figure out how. I don't like other solutions.

Let's try it! ;D

@WitchDevelops
Copy link
Member

It's gonna be hard to test if any of those solutions work without somehow forcing the response from the API to see those characters... any ideas how to do that?

@nikkehtine
Copy link
Member Author

It's gonna be hard to test if any of those solutions work without somehow forcing the response from the API to see those characters... any ideas how to do that?

We could use that particular advice as the API source for testing.

const API = "https://api.adviceslip.com/advice/76";

Maybe instead of manually testing and changing that line, we could set up a JS test that would get that advice and test if that problematic character renders correctly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants