dongpan8928 2018-09-25 20:34
浏览 28

第一台服务器打印特殊字符,第二台打印替换字符

I have two Ubuntu servers:
Server 1 - Ubuntu 16.04.5, PHP 7.0.32
Server 2 - Ubuntu 14.04.5, PHP 7.2.9

Issue:
Server 1 prints out special characters but Server 2 prints out the dreaded black diamond replacement character.

Findings:

Both servers are reading data from the same exact MSSQL table.

Both servers' php.ini file has the default_charset commented out. To test I set Server 2's to default_charset = "UTF-8" and restarted apache but no luck.

Both files' network response show Content-Type: text/html; charset=UTF-8.

Neither use a httpd.conf (I tried setting one on Server 2 for testing with no luck).

Both servers display UTF-8 when running locale charmap.

When opening each file in notepad++ the Encoding is defaulted to 'Encode in UTF-8.'

I am not sure where else to check. I know this has been asked before but each solution I find has not helped thus far. Does it have something to do with either the PHP version or Ubuntu version? What else can I check that I may have missed? Thanks for the help.


Edit 1
The code is just a test file with a select statement and echoing the result. This was merely created to find the issue so I can correct in the actual project.

Long story short, I have users that type out their hearing findings in word first and then copy and paste into the program. Unfortunately I have no way around that.

Here are a few string examples of what is getting printed out.

Server 1: with a retail–oriented
Server 2: with a retail�??oriented

Server 1: Flanagan │ Bilton, LLC
Server 2: Flanagan �?? Bilton, LLC

Server 1: Class “C” drugstore
Server 2: Class �??C�?? drugstore


Edit 2
Still looking for some help so here is the test code being used from each ubuntu server to the one MSSQL server.

$conn = connect();

    $sql  = "select ltrim(rtrim(additionalinformation)) as 'text' from tblsmdecision where petitionid = 4559";
    $stmt = $conn->prepare($sql);
    $stmt->execute();

    $row = $stmt->fetch();

    echo $row['text'];

    function connect()
    {
        $host = 'xxx';
        $db   = 'xxx';
        $user = 'xxx';
        $pass = 'xxx';

        $conn = new PDO("dblib:host=$host; dbname=$db", "$user", "$pass");

        return $conn;
    }
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 怎么用dlib库的算法识别小麦病虫害
    • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
    • ¥15 java写代码遇到问题,求帮助
    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算