Problems React encounters when using utf-8
P粉644981029
2023-08-16 18:52:59
<p>I am developing a React based solution using Visual Studio. My React .js files are encoded in UTF-8. </p>
<p>I'm using some Danish text and what confuses me is that I have to rewrite ø as ø</p>
<p>The reason I'm confused is because the browser displays UTF-8 replacement characters, so I assume it must be using UTF-8 encoding all the time. </p>
<p>Am I overlooking something obvious? </p>
<p>Here is a code that demonstrates the problem: </p>
<pre class="brush:php;toolbar:false;">render() {
return (
<div>
Sogning.
Søgning.
</div>
);
}</pre>
You can use the following ways to represent them in js files:
If you use this in a .jsx file, there is no need to encode special characters. You can use it like this in a .jsx file: