scniro / react-codemirror2

Codemirror integrated components for React
MIT License
1.66k stars 193 forks source link

Unexpected  character #104

Closed nathan-wells closed 6 years ago

nathan-wells commented 6 years ago

When codemirror field is empty, it appears as if it contains the "Â" character. Then when entering text, the same character appears after the pipe as part of the cursor.

mngmattng commented 6 years ago

Hi! I am also experiencing this issue. I am unsure if it's a codemirror or react-codemirror2 issue. I also see this issue when there is an empty new line. screen shot 2018-07-20 at 10 57 11 am

If anyone has an workarounds or solutions. I would love to hear it!

scniro commented 6 years ago

@nathan-wells @Locatus Hey! Thanks for opening this. Unfortunately this is the first I've heard or seen this. Unable to reproduce on my end. Can you share some specs with me? (OS, browser, versions, etc). Also one thing does stick out right away, is there a weird doctype going in your webapp? I've seen this randomly before with different but similar weird characters and the issue boiled down to some old/weird doctype (or similar doc meta) being the culprit. Perhaps we can find something in common amongst you both.

mngmattng commented 6 years ago

Hi @scniro - Thanks for the quick response.

Quick info: package.json: codemirror = 5.39.0. react-codemirror2=5.1.0 OS: Seen on Linux, macOS, and windows Browser: Seen on firefox (linux), chrome (windows, macOS), and safari (macOS)

Interesting fact: Do not see the issue when running my app through npm start (webpack), but see it when the app is built for tomcat.

I hope that was helpful. Let me know if you require any more info.

scniro commented 6 years ago

@Locatus interesting so I suspect the issue might have something to do with how webpack is bundling. Excuse me for being terribly oblivious here but I'm not at all familiar with what's all involved to build for tomcat. Is there a special process or version of node that webpack has to run on?

mngmattng commented 6 years ago

I'm curious to know if the same scenario is happening for @nathan-wells. I'm going to start digging through what's different between the two. As well check into the doctype.

scniro commented 6 years ago

@Locatus cool let me know what you find. I stumbled across this and wonder if this could trigger any ideas? https://github.com/angular/angular-cli/issues/2077 Looks like they are seeing some issues with files not encoding correctly

nathan-wells commented 6 years ago

Package version: 4.3.0 OS: Windows 7 Browsers: Chrome & IE

I'm also using webpack and don't see the issue when running my app locally.

As far as doctype, I'm using <!doctype html>.

scniro commented 6 years ago

@Locatus @nathan-wells behold...

https://github.com/codemirror/CodeMirror/issues/5288

nathan-wells commented 6 years ago

The fix on my end was to update index.html to specify a utf-8 charset: <script src="./bundle.js" charset="utf-8"></script>