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
I have one problem when using accents in HTML. The problem is that my page is loaded sometimes with all characters ok and sometimes with the typical strange characters like Ã, only need to refresh the page to load ok or wrong... this is absolutely random but first time after clean cache is always bad loaded.
Of course I have the meta line in headers
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>"
The file have php extension, don't know if this is relevant but I include the next two lines in the php section:
header("Content-Type: text/html;charset=UTF-8");
ini_set('default_charset', 'UTF-8');
Thanks
Those settings tell the browser what encoding you say you are using but doesn't change your encoding itself,
if your data is not utf8 encoded you need to encode it in your code using something like the utf8_encode() function or the mb_convert_encoding() function.
you can use the function mb_detect_encoding() to find out what encoding your data is in, en then encode accordingly.
I have used Tamil fonts and it is displaying the correct font when I run it in local server. But it is showing like X.Ã.uhkrhä bu£oah® in webpage. How to solve this? Please help.
Add the below code on your php script.
<?php
header('Content-Type: text/html;charset=utf-8');
try this ,
<meta charset="UTF-8" />
You need to do two things
set meta data to utf-8 (as given in answers here)
Save the page in UTF-8 encoding instead of ASCII (then browser will know this page contains UTF-8 content)
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!
Recently I switched hosting from one provider to the other and I have problems displaying Cyrillic characters. The characters which are read from the database are displayed correctly, but characters which are hardcoded in the php file aren't (they are displayed as question marks).
The files which contain the php source code are saved in utf-8 form. Help anybody?
Try placing a meta tag indicating the encoding in the head section:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
My PHP module was exactly with same problem all text was like "?????????????????"
And my code was written with Notepad++. I found the solution for the problem. The problem wasn't in the header charset or meta tag because the browser actually knows that it is the UTF-8 charset. I tried all encodings from the browser and the result was the same so I knew the problem is somewhere else, not in the browser character encoding at all.
I just opened the PHP module with Notepad++ and selected all code. After that in the Encoding menu I selected "Convert to UTF-8." After uploading to the server, everything worked like a charm.
put this after connecting database:
mysql_query("SET NAMES UTF8");
for mysqli
mysqli_query($connecDB,"SET NAMES UTF8");
and in the header of the page:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
The problem seems quite strange.
What's the form of these question marks? Is it black diamonds with questions or just plain question marks?
First of all double check if your files are really utf-8 encoded.
Try to add this header to your code (above all output)
header('Content-Type: text/html; charset=utf-8');
But I doubt it would help, as your database text already looks good.
Do you have any SET NAMES queries in your code? What charset it is set?
It had something to do with the encoding of the php files. The files were created using Windows Notepad and saved with utf-8 encoding.
When I used Notepad2 to open the files, the encoding of the files was "utf-8 with signature". When I changed encoding to "utf-8", the text displayed correctly.
The reason for your problem is often accidental re-encoding the script files by a programmer's editor. It isn't a good practice to hardcode strings which rely on encoding in your php files.
Try switching your browser's encoding to find what encoding is used for hardcoded text, it might help you address the issue. Also make sure to send proper http headers for each page:
header('Content-Type: text/html; charset=utf-8');
Optionaly you can insert meta tag in you HTML:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
For me, the line that made the difference is the following:
$mysqli->set_charset("utf8")
Straight from the PHP documentation page.
The server was returning latin, after setting the charset to utf8 now works fine.
I have been fighting with this exact same problem as I'm trying to add a bit of french/german internationalization to a few controls on a widget.
Characters with accents that are stored in my db print fine as UTF-8. However, characters that are hardcoded into arrays in PHP files either display as the black diamond with a question mark inside or the little square box.
I've tried encoding/decoding the hardcoded strings from my php file every which way, but couldn't get the characters to display properly.
Since I have such a finite set of characters and am working strictly with HTML, I just added a bit of functionality to my intl class to substitute the characters for html entities.
I have these properties.
static $accentEntities = array('á' => 'á',
'É' => 'É',
'é' => 'é',
'í' => 'í',
'û' => 'û',
'ü' => 'ü');
static $accents = array();
static $entities = array();
I setup some my replacement arrays in my constructor...
foreach (self::$accentEntities as $char => $entity) {
self::$accents[] = $char;
self::$entities[] = $entity;
}
And then when I need one of my hardcoded strings in my class I just return it like so...
return str_replace(self::$accents,self::$entities,$str);
It's a totally ghetto solution... but for now, it works. I'd definitely like to hear the correct way to display accents/special characters that are hardcoded into a PHP file.