Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

German Umlauts + btoa(unescape( encodeURIComponent( ... #5

Open
stefanibus opened this issue Mar 11, 2017 · 9 comments
Open

German Umlauts + btoa(unescape( encodeURIComponent( ... #5

stefanibus opened this issue Mar 11, 2017 · 9 comments
Labels

Comments

@stefanibus
Copy link

Hi!
saving the encoded URL causes a severe encoding issue when the Notepadlet get saved and then displayed via my localhost.

This is the issue : German Umlauts will no loger be displayed propperly.

The solution to this issue might be to apply unsecape before encoding the window.url.

I can imagine this solution to improove the Notepadlet generally. I can only see an improovement and no downside in applying unescape.

Please find the enhanced line of code below. The creator of this Notepadlet might decide whether or not this shall be included to the notepadlet .

setTimeout(function() {
window.location = 'data:text/html;charset=utf-8;base64,' + btoa(unescape( encodeURIComponent( document.documentElement.outerHTML )));
}, 200);
});

@jehna
Copy link
Owner

jehna commented Mar 11, 2017

Hey, thanks for adding this issue

How can I reproduce this bug? On which browser?

@jehna
Copy link
Owner

jehna commented Mar 11, 2017

On chrome and firefox at least äöåü seems to work just fine

@jehna jehna added the bug label Mar 11, 2017
@stefanibus
Copy link
Author

stefanibus commented Mar 12, 2017 via email

@jehna
Copy link
Owner

jehna commented Mar 12, 2017

Hey. I tested with the following process with windows 7 + chrome (latest) and could not reproduce the bug:

How I tried to reproduce

  1. Open notepadlet
  2. Write äöäöä
  3. Save file to disk
  4. Run python -m SimpleHTTPServer in the directory where you saved the file
  5. Open http://localhost:8000/ and select the file you just saved

Result:

The string äöäöä reads out just fine.

@jehna
Copy link
Owner

jehna commented Mar 12, 2017

My best guess currently is, that your web server sets charset header that conflicts with the charset that's set when you save the file.

There's a couple of things you could do:

1. Send a link to malformed file

If you have some public server where you can reproduce the bug, it'd be great to see it in order to have a look at the headers the web server is sending. That might help to find the bug.

2. Write a more detailed reproduce steps

I'd need to be able to reproduce the bug so I can validate what the unescape(encodeURIComponent(...)) is doing in your case and whether it is the correct fix for the problem.

@jehna
Copy link
Owner

jehna commented Mar 12, 2017

In addition to the number 2 in the previous comment: This is a good template that I've used to describe the issue:

How to reproduce:

  1. Write all necessary steps to reproduce the bug, like
  2. Open ...
  3. Click ...

(include all versions of software you were using)

Expected result:

What do you expect to happen after your "how to reproduce" steps

Actual result:

What actually happened?

@stefanibus
Copy link
Author

stefanibus commented Mar 12, 2017 via email

@jehna
Copy link
Owner

jehna commented Mar 12, 2017

@stefanibus I understand from the forum that there is an issue with btoa/atob with characters outside Latin-1 range. I've opened the issue #6 to check it out, thanks for pointing it out.

However Latin-1 does include all German language characters, so this does not explain how your scenario is not displayed correctly.

Could you provide more detailed information about the web server you are using or provide a more detailed info about how to reproduce this issue?

I want to point out that "display it on your local or on your public server" is not detailed enough, as I did try to display the page with SimpleHTTPServer and it worked just fine. So any info about your server or other way to reproduce this bug would be appreciated.

@stefanibus
Copy link
Author

stefanibus commented Mar 13, 2017 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants