css - 在 "Internet Explorer"中加载图像 - 服务器的参数是 "????"

标签 css html internet-explorer

在 Internet Explorer (10) 中加载图像时出现问题,而在 chrome 和 firefox 中则正常 当 username 参数为希伯来语(rtl 语言)时 css 和 html 出现问题:

background: 0 url('php/ajax/ajax-user-image-read.php?username=רועי') no-repeat';

img src="php/ajax/ajax-user-image-read.php?username=רועי" alt=""

英语都可以

background: 0 url('php/ajax/ajax-user-image-read.php?username=roee') no-repeat';

img src="php/ajax/ajax-user-image-read.php?username=roee" alt=""

当希伯来语我收到用户名参数时????在服务器端。

我的 html 页面有 meta charset="UTF-8" 并且所有其他希伯来语工作正常。

我不认为 php 代码在这里有帮助,因为它收到问号而不是有效数据,但这里是:

<?php

session_start();

require_once '../gw-database.php';
require_once '../gw-functions/gw-functions-user.php';

if (isset($_SESSION['username'])) {
    if (isset($_GET['username'])) {
        if (!empty($_GET['username'])) {

            $username = ('current' === $_GET['username']) ? $_SESSION['username'] : $_GET['username'] ;

            $image = userImageGet($username);
            if (false !== $image) {

                header('Content-Type: '.$image['type']);
                echo $image['image'];
            }
            else {
                logRunTimeMessage($_SESSION['username'], 'server', $error, 'In file '.strrchr(__FILE__, "\\").' at line '.__LINE__.' - Error fail to get user image', time());
            }
        }
    }
}

最佳答案

使用URLENCODE

示例:

$username = 'רוע';
/*... some code ...*/
src="php/ajax/ajax-user-image-read.php?username=<?php echo urlencode($username);?>" alt=""

关于css - 在 "Internet Explorer"中加载图像 - 服务器的参数是 "????",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20957263/

相关文章:

css - progid :DXImageTransform. Microsoft.AlphaImageLoader 导致链接在 ie8、ie7 和 ie6 中无法单击

google-chrome - 为什么我的 div 标签的高度在 Chrome 中被计算为 0?

css - 响应式布局中的相邻元素

html - 如何覆盖 Bootstrap 4 中的 nav-pills 下拉样式?

HTMLQuestion 中 JavaScript 无法正确读取

html - 具有最大宽度 td 的表格中的文本在 IE7 中被截断

html - HTML 的 CSS 只出现在 Chrome 而不是 MS edge 或 IE

c# - 通过 C# 代码隐藏打开 CSS 弹出窗口

css - 是否可以更改样式的颜色组件?

html - CSS 计数器无法在 Internet Explorer 中用于隐藏内容 - 如何修复?