简体   繁体   English

Internet Explorer中的奇怪字符

[英]Strange Characters In Internet Explorer

I am using php code to display Amount from Database And Using Following Code. 我正在使用php代码显示数据库中的金额并使用以下代码。 But In Internet Explorer, Strange characters Are Seen (Please see attached images) Same In Below Region, There is No coding, Till Internet Explorer is showing some strange character. 但是在Internet Explorer中,看到了奇怪的字符(请参阅附件的图像)在下面的区域中相同,没有编码,直到Internet Explorer显示出一些奇怪的字符。

I have attached 2 images - one from IE And second is from Chrome Browser. 我已附加了2张图片-其中一张来自IE,第二张来自Chrome浏览器。

code used to display amount is - 用于显示金额的代码是-

$qty = $row['total_amount'];
setlocale(LC_MONETARY, 'en_IN');
$amount = money_format('%.0n', floor($qty));

And in table showing amount - 在显示金额的表格中-

<?echo $amount;?>

In Below Part where Blank Space Should Be there, IE is showing strange characters, CODE Is - 在下面的空白处,IE将显示奇怪的字符,CODE为-

<div width="90%" style="border:2px outset #336600; border-radius:10px;  padding:5px;"><b>Alphabetical Doctors List Who Donated For High Court Case</b><br>

And Then pagination php code and following code - 然后分页php代码和以下代码-

<div><?php   echo Pages("tutorials",$perpage,"index.php?");     ?></div>

What can be reason and Solution ? 什么是原因和解决方案?

Image 1 -(Internet Explorer) 图片1-(Internet Explorer)

在此处输入图片说明

Image 2 - (Chrome) 图片2-(Chrome)

在此处输入图片说明

I used following solution for this problem... 我使用以下解决方案来解决此问题...

Changed code 更改代码

$qty = $row['total_amount'];
setlocale(LC_MONETARY, 'en_IN');
$amount = money_format('%.0n', floor($qty));

TO

$qty = $row['total_amount'];
setlocale(LC_MONETARY, 'en_IN');
$amount = money_format('%.0n', floor($qty));

$qtyIE = $row['total_amount'];
$amountIE = (floor($qty));

And Made changes in table displaying result 并更改表显示结果

From

<?echo $amount;?>

TO

<? if ( eregi("MSIE", getenv( "HTTP_USER_AGENT" ) ) || eregi("Internet Explorer", getenv("HTTP_USER_AGENT" ) ) ) {
?>
Rs. <?echo $amountIE;?>

<?}else{

echo $amount; }?>

So Instead Of Showing Strange Characters, Now It Is Showing Rs. 因此,现在显示的是Rs,而不是显示奇怪的字符。

I don't know, Is it right solution or not...But I did it.. 我不知道,这是正确的解决方案吗...但是我做到了。

There are two distinct issues here: 这里有两个不同的问题:

1) The page uses UTF-8 encoding but does not declare it properly. 1)页面使用UTF-8编码,但未正确声明。 From the comments, it seems that in this case, adding <meta charset=utf-8> is sufficient. 从注释看来,在这种情况下,添加<meta charset=utf-8>就足够了。 Regarding the issue more generally (in PHP context), see UTF-8 all the way through 关于更一般的问题(在PHP上下文中),请始终参阅UTF-8。

2) The INDIAN RUPEE SIGN is relatively new in Unicode. 2)印度卢比符号在Unicode中相对较新。 It is included in newest versions of several fonts and in some special fonts. 它包含在几种字体的最新版本和某些特殊字体中。 Web browsers might be unable to render it even if the system contains some fonts that have a glyph for it; 即使系统包含某些带有字形的字体,Web浏览器也可能无法呈现它。 they may need help from the author as aa font-family setting. 他们可能需要font-family设置中的作者帮助。 There are existing questions on this at SO, eg Indian rupee symbol , though the current answers might be somewhat outdated or too abstract. SO对此存在一些疑问,例如印度卢比符号 ,尽管当前答案可能有些过时或过于抽象。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM