Paul Nelligan
Paul Nelligan

Reputation: 2005

€ symbol rendering as €2

Unusual problem here: I have an app that uses a text file which contains a few '€' symbols as well as other text in a text file to populate a mysql database. When rendered locally, the € symbol looks fine, but on the linux server and out on the web in html, it looks like this in some browsers:

€2

can anyone suggest a solution

Upvotes: 2

Views: 436

Answers (3)

Jeffz
Jeffz

Reputation: 2105

If you are viewing your text (.txt) file as a text and not HTML in browsers window, setting

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">

will not do the job as you are dealing with text file,

so tags will not be "hidden", plus it may potentially (even most likely) send garbage to mysql database you are trying to populate (e.g. by auto-harvesting posted online file).

So, if in browser window instead of:

€ 123.39

you are seeing

€2 123.39

problem is not with quality of your text file, but with the way browser handles encoding.

If you need to copy and paste displayed file and "€2" is in the way,
try simply setting your browser default encoding to unicode (UTF-8).

In FF you want to do it here:

Tools-> Options-> Content (tab)-> Fonts&Colors-> Advanced-> Default Char. Encoding

Once there select UTF-8 encoding.

Remember thou that sometimes page reload may not be enough to see changes, due to browser cache. In such case, restart your browser.

Upvotes: 1

Valentin Flachsel
Valentin Flachsel

Reputation: 10825

Use an UTF-8 encoding type on your file and make sure you add a content-type meta tag to your page:

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">

Hope this helps !

Upvotes: 3

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 799570

Set the charset in the headers or a <META> element to UTF-8 so that it isn't processed as CP1250.

Upvotes: 4

Related Questions