-
Notifications
You must be signed in to change notification settings - Fork 334
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
charset in iframe is not utf8 #184
Comments
Hmm, I can't reproduce this on my end since I use it everyday with spaces. Do you think adding the UTF8 meta tag will fix this? Could you send a pull request of a fix? If not ill try adding the UTF8 meta tag in another branch and let you try it out. |
Yeah I get this too. It's really annoying. I had to filter unicode out to fix it. When I use 4 spaces and export, I get 2 unicode chars at the start of the line. So when I pass it to be formatted, it doesn't see the code block. I can write up a test tomorrow... |
Are you on a western keyboard? And are you seeing this in your console when you do exportFile or after it goes into a DB or something else? On Sep 23, 2012, at 8:39 AM, "Maxwell Swadling" notifications@github.com wrote:
|
Yeah, tried even changing languages and no luck. What browser, OS, and keyboard setup are you guys on? |
Ok here is the bug. https://github.com/maxpow4h/EpicEditor/commit/c4969d2d6654c83d56abbad693aa1a42a88a940a Get the gh-pages branch and make apply that patch / make those 2 changes. In the editor write up something like
Then hit the try button, it does a ajax post to You will see something like this: But if you inspect the chars, you should see This is on Mac, Chrome, Japanese Keyboard in Romaji. |
Until I get a second to play with it, does adding the UTF8 meta tag to the editor fix the issue? On Sep 23, 2012, at 10:10 AM, "Maxwell Swadling" notifications@github.com wrote:
|
oh, and big thanks for this test case! I've heard a couple other people doing Ruby stuff have this issue so hopefully your test case will help me figure this out! On Sep 23, 2012, at 10:10 AM, "Maxwell Swadling" notifications@github.com wrote:
|
Trying to test it but when I try to install Sinatra:
Not much of a ruby guy. looking into it tho |
So, I did a test with a node framework (Geddy). I checked my DB and see: No special characters. This is with the following code: I then tried looking at what gets output into the browser if I empty the contents raw, but I just see actual spaces: I'm thinking this is either a Ruby or japanese keyboard specific thing. Here's a stackoverflow thread on something similar if not the same issue: http://stackoverflow.com/questions/11512592/ruby-markdown-string-processing-issue-with-encoding The guy there said it was not an EpicEditor issue, but if there's a fix I can make on the front-end side to fix Ruby I'd love to do it. Unfortunately I'm not well versed in Ruby and Sinatra doesn't seem to want to install on my machine. Any help debugging that error or if you use another framework or just raw ruby would help :) UPDATE: |
Ok, can you try using this
And using a POST like this
That will treat it like ASCII, so if you see this in your terminal. Then we both have the bug. I don't think it's a Ruby bug, but it could be something with my keyboard. I'm still testing that out. EDIT: The post on stack overflow has an server side fix by doing:
So I think these are the chars we should be looking at debugging. |
@OscarGodson my system configuration is pure English with language supporting Chinese. And I was inputting English using English keyboard setting. |
I just tried the U.S. keyboard on Safari and got the same bug. |
Well, in the example you have above you're converting the encoding to ascii, right? So, no matter what the encoding was before it'll be messed up because you're converting a rich encoding down to ascii. This is why, by default, this works out of the box with in Node (express, geddy, etc). You're manually trying to convert to ascii. The original ticket says "charset in iframe is not utf8". There's a simple way to test this:
Put that in your console on http://epiceditor.com or locally or wherever. For me it says I believe your Rails(?) app or other kind of Ruby app is not setting the character set header correctly or at all... I think. When you load your app thats giving you this issue is the Can you put that JS in your console and also see what headers your app is sending out? |
Hi Oscar, My HTML has header "Content-Type: text/html; charset=utf-8", and my web app On Mon, Sep 24, 2012 at 11:13 AM, Oscar Godson notifications@git.luolix.topwrote:
Regards, http://about.me/davidshen |
Hmm. What does that line of JS return? That's (characterSet) a native JS method so it won't be wrong. Running out of ideas if that JS call says UTF8... Can I see your JS? Are you setting the encoding type on your AJAX POST request? On Sep 23, 2012, at 8:44 PM, "Xi Shen" notifications@github.com wrote:
|
I tried On Mon, Sep 24, 2012 at 12:26 PM, Oscar Godson notifications@git.luolix.topwrote:
Regards, http://about.me/davidshen |
Ah ha, that's probably it. I'll need to research how to override that. I think that UTF8 meta tag will fix it, but I'll need to figure out how to change the default encoding. On Sep 23, 2012, at 10:03 PM, "Xi Shen" notifications@github.com wrote:
|
@davidshen84 what do you see when you do the characterSet call in your app in Chrome's console? Is it the same or different? |
@osca, sorry, i cannot get the reference to the editor instance, and i On Mon, Sep 24, 2012 at 2:47 PM, Oscar Godson notifications@git.luolix.topwrote:
Regards, http://about.me/davidshen |
That's fine whenever you can. This bug is looking to be tricky especially since I'm having front end issues trying to dynamically set the character encoding. :) On Sep 23, 2012, at 11:52 PM, "Xi Shen" notifications@github.com wrote:
|
I think it is a problem with the editor. Try this on the default docs page.
Where it should have 4 "32"'s for the 4 spaces, it has "32" "160" "32" "160". The "160"'s are the broken chars... |
Awh, 160 is |
…ld appear in some cases on some platforms because they didnt understand no-break spaces (such as ascii)
The fix is in develop. Can you guys check it out and see if that actually does fix it? Now the tryItBtn only returns 4 Thanks a lot @maxpow4h !!! |
Awesome! Thanks for the fix! |
I think the issue has not been fix completely. When I edit the content,
But when I try to edit the content again, the 4 spaces are gone. This issue does not reproduce on http://epiceditor.com/, which does not have the latest developer version. I think the editor needs to retain the char(160) for HTML to render the content in the editor-view correctly, |
I think it has something to do with how you're saving it or giving it back. The develop branch is working as expected: Tested on Firefox too. You can't test against epiceditor.com because you're passing it through a backend and DB. Could you show me with jing maybe? Maybe let me see your logs or give me the exact steps to repro it? @maxpow4h Did you ever test this? Did the fix work for you or not? In the meantime I'll setup a quick geddy + mongo "app" and see if I can reproduce this. |
Awh, yep. I was able to repro this by doing some stuff with geddy. Working on it! Something with the importFile method |
…-break space in chrome which is a unicode character \u00a0. Firefox was fine because we already were replacing spaces with s
OK @davidshen84 could you pull and try again :) fingers crossed - it worked for me in my quick little blogging app I just did. @johnmdonahue we need some tests to test that spaces are preserved correctly. Not sure how to test that tho off the top of my head. If you ever get time let me know if you have any good ideas on how to test all these spacing cases. |
@OscarGodson ah, I only export file, I don't import, so I never noticed. edit: pulled latest version and added an importFile, works for me fine too. |
i create a epicEditor with default setting, and entered below text:
then i get the content from the editor by using:
when i post the data to my server, i saw
the spaces are incorrectly encoded
The text was updated successfully, but these errors were encountered: