Symbols instead of text, how to change? - php

I make pages with Russian texts and in chrome veiw-code see this:
img
How can I change this symbols to text?

Cyrillic text should automatically be converted if properly formatted.
Look at this page for reference on Cyrillic signs as HTML entities;
W3 Schools Cyrillic text
You might also want to specify that your website is using UTF-8 by placing the meta-charset tag in the header section of your HTML;
<head>
<meta charset="UTF-8">
</head>

Since I dont have way to comment I have to put, cannot you tell the page to use russian alphabet?

Since you didn't put your code i assume that you didn't set the charset to utf-8.
Try Set HTTP header to UTF-8 using PHP

Related

HTML source code doesn't understand Arabic text?

I'm trying to read a source code for a webPage that contains Arabic text but all what am getting is this جامعة (which is not Arabic, only a group of characters).
If I reload the page on my localhost I get the Arabic tags and text correctly.
But I really need to read that source code. any suggestions or lines of code I can add?
<html dir=rtl>
<META http-equiv=Content-Type content=text/html;charset=windows-1256>
These are few lines from that include the "encoding" used! The page is written using HTML and PHP
The characters are merely escaped to HTML entities. The browser decodes them to "real characters" when it renders the page. You can decode them yourself using html_entity_decode:
html_entity_decode('جامعة', ENT_COMPAT, 'UTF-8')
Note the last parameter, which sets the encoding the characters will be decoded to. Use whatever encoding you're working with internally, I'm just suggesting UTF-8 here.

Greek text writing problem

i am working on php. in my index.php page i have included right.php. right.php contains greek text. index.php has the html headers. the greek text are not showing correctly. when i open the right.php file in dreamweaver and save the page, it gives warning about the text. what can i do to solve this? because right.php has common contents which is used in many pages.
This is all to do with the content type of your pages. Most likely you are trying to save / display the text in latin1 format which doesn't support the characters you are trying to display.
The most sensible thing to do is convert everything to UTF-8. If you're manually editing the text then ensure your text editor (i.e. Dreamweaver) is set to save the files as UTF-8 and then ensure you have the following meta tag on your page
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
Make sure you are saving your files as UTF-8 encoding (check preferences in DreamWeaver to find file encoding). Also make sure your HTML <head> tags include charset similar to this: <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
You can use a different character set if you prefer, but UTF-8 supports the entire Unicode character space, so it's pretty safe.
You have to set file encoding to utf-8 and set it also in <meta> charset tag in <head> HTML.

Character encoding in javascript file and a simple php file

I got problem with some special characters. I have defined the meta tag as
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
so far so good. But in one occassion I have a select tag with many options with many special characters. I got problem showing (å ä ö). They are defined in .js file and are appended to the document using DOM. Pls. are there any solution except using &... forgot the name for that type.
Second character problem I have is in php. I try to send an email with Amazon SES.
<?php
$message['Body.Html.Data'] = "Please Confirm that you are a Tönt by clicking on this link"." ....<a href='s'>Tönt</a>";
$message['Body.Html.Charset'] = 'utf-8';
?>
the ö is not showing properly?
You'd better use:
<?php header('Content-type: text/html; charset=utf-8'); ?>
At the very top of your PHP file, no need to use http-equiv metas when you can send some real http headers ;-)
Also check if your files (both PHP and JS) are encoded in UTF8 in your editor.
Setting an UTF8 header on non UTF8 files will produce strange results for sure!

Strip out special characters

I pull some data from a HTML page with a list of products and for some text it looks like this:
Organicâ„¢
In the HTML page when I look at that same text I can see its supposed to read Organic with the TM (Trade Mark) symbol after it. Why does it look like the above!
My main question is How can I get rid of TM, # and Copyright symbols so I am just left with a clean name of the product?
Thanks all for any help
Your page has the wrong character set declared (or no character set declared at all).
View the source HTML and see if in the head section there is a tag like <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
If there's no such tag, or the tag is there but the charset bit is missing, you haven't declared a character set. If the tag is there and the charset bit is present, the declared character set is wrong. Looking at the specific example you gave, it looks like the text might be in UTF-8 but is being displayed as latin-1.
It's an encoding issue ; there's a gap between your html page encoding, and your output device encoding.
You'll have to rationalize this. The best is to have your working environment in utf8, and to convert all external data into utf8.

Arabic characters corrupt on landing, fine after refresh - UTF8

I have an php page with mixed Latin and Arabic characters. The charset declaration tag is in the html code
and the file is saved as UTF-8. All the text is static and in the php file (does not come from a DB or an external source)
When I browse to the site some pages randomly get corrupt in IE and FF and display all question marks. After I refresh the page, text is displayed properly though... I have been working with Arabic and Hebrew for a long time and this is the first time I run in to this issue. Can anybody think of a cause?
Chrome is always fine...
Turns out the script reference that was before the meta description was causing the problem. I moved
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
to be the first item after the opening head tag and this is no longer an issue. Thanks for all the comments..
P.S I wasn't the one who code this page, and only working on localizing it, thats why I didn't even think that meta tag being after script would even make a difference...
Try to send appropriate header, something like this:
header("Content-Type: text/xml; charset=utf-8");
Try using UTF8_encode on your content:
http://php.net/manual/en/function.utf8-encode.php
If you have some text you want to store in a DB and display even if the page encoding is latin-1, there is a free tool that can convert Unicode to escaped HTML:
http://www.sprawk.com/tools/escapeUnicode

Categories