How to use tamil fonts in php page? - php

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)

Related

Symbols instead of text, how to change?

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

PHP Include: Losing UTF-8 characters on included code

I'm including a menubar through php include and for some reason the menubar doesn't display UTF-8 special characters.
The rest of the page works fine, just not the left navigation.
What could be the reason? I tried adding:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
on the included file too but I still can't get the caracters.
I'm testing it here:
http://www.lilianasanmiguel.com.ar/acol1.php
Make sure that you actually save the files in UTF-8 encoding in your editor.
Check if the file you include is uft-8 encoded. In Eclipse you can do so by right-clicking in the file an check under "Properties"
Be aware that the standard PHP string functions won't work with UTF-8 - they all assume a fixed with character set. Check your code and make sure you're using the mb_* equivalents instead.

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!

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

PHP Japanese Strings getting set to?

I have a PHP file with one simple echo function:
echo 'アクセスは撥ねりません。';
but when I access that page i get this:
????????????
Can someone help me?
I also have my page encoding set to UTF-8, and I know it, because all of the browsers i used said so.
I also do this before the echo function:
mb_internal_encoding('UTF-8');
What does this do?
Does it help me?
All I need is to be able to echo a static Japanese string.
Thanks!
There are a few places where this could go wrong.
Firstly, if you aren't setting the output encoding in php with header()
header('Content-type: text/html; charset=utf-8');
or in your html with a meta tag:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
you will need to check the php.ini setting default_charset. Chances are this is defaulted to iso-8859-1
Secondly, you may also need to check the content encoding you are saving the php script as. If you are saving it as ASCII or some other latin charset, it will munge the characters.
I got it.
I just had to set the mbstring extension settings to handle internal strings in UTF-8. Thas extension is standard with my build of PHP 5.3.0.
Maybe you are printing Japanese characters contained in UTF-16 (extended set of chars)?
I just did a quick test and your example works for me, so it's most likely one of these:
Your file is not saved in UTF-8, but some other encoding, such as Shift-JIS. A decent editor should be able to let you see what encoding it used
Your server is sending bad http headers. Can you use some tool to check the headers and paste the results? Or the results you got from the browser?
The browser is using an incompatible font
I saved a file in UTF-8, pasted your code into it, and my server is serving the file with Content-Type: text/html; charset=utf-8 and it shows up just fine. Did not need to use the mb_ function or anything else.

Categories