Help using the £ character in php echo

Possible duplicate:
Encoding problem: Pound symbol appears as <> symbol

I make a few basic expressions of the echo, and when I use the echo "E", it sets the capital A before the pound recognizes any ideas, why?

echo ("£"): output = A£ 

A has the character above.

+4
source share
3 answers

There are several ways to do this pragmatically:

 <?php echo chr(163); printf("%c", 163); echo "&pound;"; //preferred for HTML ?> 

Another way to do this “manually” is to save your files in UTF-8 encoding.

See here for more details.

Here is a screenshot of the results:

results

As stated in primatology, if you intend to exit in HTML, be sure to include the correct encoding header for HTML. This should be inserted between the <head> tags.

 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
+3
source

You must encode the php file as UTF-8 or use

 &pound; 
+1
source

Make sure your HTML page is marked as UTF-8 (Unicode encoding). For bulletproof support, put this on your head :

 <meta charset="utf-8"> 

You must also save the file with UTF-8 encoding. Most text editors have a built-in feature for this.


If on Apache you can also send UTF-8 encoding to the Content-Type header by adding this to .htaccess :

 AddDefaultCharset utf-8 
0
source

Source: https://habr.com/ru/post/1402564/


All Articles