Some space showing � in the html page - html

In a html page, some space showing �. I am also using
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
in the head, but not working. Here is an example:
Movie: Bombay Velvet
Singer:�Suman Sridhar
Music:�Mikey McCleary
Music Label: Fox Music
I am trying to figure out from yesterday, but couldn't. Please help, what might be causing this issue.
Solved: mysql_query("SET NAMES 'utf8'", $connect);
Thanks to everyone.

As your data comes from a Database and PHP. You can set connection enconding at startup.
If you are using Mysqli connection driver you can do this:
mysqli_set_charset ( $mysql_connection , 'utf8' );
or in OOP:
$mysql_connection->set_charset('utf8');
Reference: http://php.net/manual/pt_BR/mysqli.set-charset.php
In another drivers you need to see similar function.

Related

As3 urlrequest charset

var urlRequest:URLRequest = new URLRequest("子系统.swf");
loader.load(urlRequest);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
Everything works fine when i use native swf to load another swf.
But after i embed my main swf to html, it reports error:
"NetworkError: 404 Not Found http://127.0.0.1:8020/huanmao/%D7%D3%CF%B5%CD%B3.swf"
I don't understand when does "子系统" become "%D7%D3%CF%B5%CD%B3", i can't find any charset option in UrlRequest. If i use English name instead of Chinese, the problem disappeared.
This is my html charset setting
http-equiv="Content-Type" content="text/html; charset=utf-8"
All my files is edited in utf-8.
I'm really confused. This problem is killing me!
Any help would be appreciated!!
Few years ago, I faced same issue.
If you are using tomcat, add these attributes at your 8020 port Connecter.(at server.xml)
URIEncoding="UTF-8"
useBodyEncodingForURI="true"
This is my settings.
<Connector port="8400" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="9400"
URIEncoding="UTF-8"
useBodyEncodingForURI="true" />

store Hebrew in database with utf- 8 encoding using php and mysql

I am building a web site with database in Hebrew (using php and mysql).
on general I use chrome to test my job...
today I tried explorer :-0 (yeh... you must be thinking "why the f*** would he do it... ;) ). I found out that all the data that is sent from explorer is stored in ????? and cannot be used.
I use <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> on the main page
and header('Content-Type: text/xml charset=utf-8');
on the php page that sends the xml files (after he receives get request)
on my connect.ini.php I included the following code:
mysql_query("SET NAMES 'utf8'",mysql_connect($host, $user, $password));
my ajax javascript is:
if(xmlHttp.readyState==4||xmlHttp.readyState==0){
gender=document.getElementById("gender").value;
xmlHttp.open("GET","file.php?gender="+gender , true);
xmlHttp.send(null);
}else{
setTimeout('submit_quick_start_form()',1000);
}
as i said before in chrome everything is fine...
Please help guys...
(click for full size)Shown in the first 3 GETs, in order, I found that Chrome, Firefox, and IE all produce different results. But I guess theoretically, Firefox does it right. In any case, they all give the same result (next 3 GETs in order), if we encodeURIComponent() the input.value. Like such:xhr.open('GET', location.href+"?"+encodeURIComponent(test.value), true)......<input type=text id=test name=test value="שלום מישה">

Twitter Cards Not Validating

I am trying to test out the twitter cards and can't figure them out. I coppied one of their examples and just changed target link so it would link to my site. I created this quick example website to test out: http://www.canvasmagazine.tk/index.htm/
When I go to twitter card validator, it keeps returning the same error.
ERROR: FetchError:exceeded 4.seconds to Portal.Pink-constructor-safecore while waiting for a response for the request, including retries (if applicable) (Card error)
So I took out the CSS which has custom fonts and background and would slow down the runtime. Yet I still received the same error. I also went back and forth changing the metadata from name to property and then combined this with the above and still no luck. Hopefully it is something obvious I'm missing. Any help would be appreciated.
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:creator" content="#Environmentnyou">
<meta property="twitter:domain" content="http://canvasmagazine.tk/index.htm">
<meta property="twitter:title" content="Canvas Magazine | ">
<meta property="twitter:description" content="test">
<meta property="twitter:image" content="http://canvasmagazine.tk/images/tile.jpg">
EDIT: I also tried close "/>" each meta tag instead of ">", yet this made no difference.
EDIT2: SOLVED. Twitter has blocked my server.
I am too getting this problem and we were not able to figure out the issue. But i have found certain troubleshooting steps which might be helpful to you.
Check robots.txt and make sure that user-agent: twitterbot is allowed. Sometimes, Twitter is blocked from reading the metadata by this file.
Check that the IP Addresses of twitter server is not blocked by your host. These are the IP Address used by twitter:
199.59.148.209
199.59.148.210
199.59.148.211
199.16.156.124
199.16.156.125
199.16.156.126
(Source: https://dev.twitter.com/cards/troubleshooting)
Also, Twitter’s ASNUM is AS13414.
Your Apache .htaccess file is denying requests.You can check this by opening your .htaccess file and looking for something like the following:
deny from 199.59.149.*
Follow above mentioned troubleshooting steps and let us know if works for you!
Thanks,
Rakesh Solanki

phpinfo() Expression Web 4

I've installed Microsoft Expression Web 4, installed php 5.3.28, renamed the php.ini-production to php.ini, did display_errors=on, did cgi.force_redirect=0, switched the positions of php_mbstring.dll and php_exif.dll (ran php.exe and it said it could not find php_mbstring.dll), directed expression web to the php-cgi.exe, and forced expression web 4 to boot a server for every test. I run the sample code for php information as follows...
file name - "index.php"
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled 1</title>
</head>
<body>
<?php
phpinfo() ;
?>
</body>
</html>
I get a blank page (WSOD), and am still looking for a solution.
In short I've been following the instructions given here.
And followed up with some additional potential fixes with little success.
Thank you in advance for your time.
Solved the problem, did a full reinstall of all products involved.

Successfully posting html encoded and including a pound sign to a VB.net method

I am posting a form which sends an email, the HTML for part of the email body is created and posted by jQuery and an AJAX post method to a web method in ASP.net using VB.
Here's a snippet
var tbl = $('<table/>');
var paymentCell = $('<td/>').html('£' + thisAmount).appendTo(row);
$(row).appendTo(tbl);
// Generates the element in question
This, amongst other things are then posted as a data variable by AJAX, the data variable looks something like this:
var data = '{ "emailHtml":"' + escape((wrap).html()) + '"}';
This is then decoded on the server side like this:
emailHtml = HttpUtility.UrlDecode(emailHtml)
This all works fine except for pound signs, which are not decoded properly. I have tried using £ as per above, and £ to display the HTML characters but I am always getting a weird ? symbol returned in the html decoded at the server end... is there a way round this?
Have you tried it without the escape() call, as jQuery allows for built-in encoding, so I think your value is being double-encoded.
Make sure you are using UTF-8 as your encoding and charset in your application, like this:
web.config:
<system.web>
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
</system.web>
HTML pages:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />