Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mdash incorrectly rendering on Android phone (but not on PC) <- well not actually!

Status
Not open for further replies.

PeDa

Technical User
Oct 10, 2002
227
NL
If my straight html pages contain an mdash character these are correctly rendered in different browsers on both my Android mobile phone (Samsung) and my Windows PC. If however this character is contained in text loaded from MySQL/php it correctly renders on the PC, but as the three characters – on various browsers on my phone.

My page header is:
Code:
<!DOCTYPE HTML>
<html lang='en'>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

and my php contains:
Code:
$db = new PDO("mysql:host=localhost;dbname=XXXXX", 'XXXXXX', 'XXXXXXXXXXXXXXXXX',array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
$Temp="SELECT * FROM tbpeople WHERE pID = :id";
$q=$db->prepare($Temp);
$q->bindvalue(':id', $id);
$q->execute();
$result=$q->fetch(PDO::FETCH_ASSOC);

Three examples here
 
You can't share localhost examples.

Specifying utf8 in this code may still conflict with how text has been stored and what font type is being rendered on any system. Example output would help to understand the issue.
 
Yes! ... and therein lies my problem; I was inadvertently looking at the PC-version on my local computer, and not at the version on the remote server. The problem erose from selecting an incorrect Character set when reading in the data into phpMyAdmin on the remore server. Sorry for the confusion. (link corrected)

Peter D.
 
Is this working for you now? The public site looks okay from here on both desktop and an android tablet.
 
Hello Spamjim,
Yes everything is fine. It was incorrect on both PC and Android, but now corrected. In retrospect it was very unlikely that the assumed PC/Android difference, across various browsers, would be real.
Peter D,
 
Excellent! However, it was still good to keep an eye on this. We should still assume PC/Android (or any other device) differences in testing. Various devices may still use different typefaces (CSS/HTML-defined and fallbacks) and region settings which may lack some extended characters like mdash. This is the eternal joy of web dev. [bigsmile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top