Data displayed in wrong format when using adodb-php with sql server on ubuntu

88 Views Asked by At

I have an old website running in php on windows, connected to sql-server through adodb library. The data saved to the DB is converted to the following form: Trương Thị Ãnh Tuyết, but when I select it, the data will display correctly as follows: Trương Thị Ánh Tuyết.

That website was working fine until I needed to switch to running on Ubuntu. It's still the same data, but when selected, it's still displayed as Trương Thị Ãnh Tuyết. Can you tell me the cause and how to fix it?

Here is the example code:

create database test
use [test]
create table users (name nvarchar(100))
insert into users (name) values ('Trương Thị Ãnh Tuyết')
<?php
ini_set('display_errors', 1);
include 'vendor/adodb/adodb-php/adodb.inc.php';
include 'vendor/adodb/adodb-php/adodb-errorhandler.inc.php';

$db = ADONewConnection('mssqlnative');
$db->connect('localhost,1433','sql','sql@12345','test');
$sql = "select top 1 name from users";
$array = $db->getAll($sql);
print_r($array[0][0]);exit;

output on windows: Trương Thị Ánh Tuyết

output on ubuntu: Trương Thị Ãnh Tuyết

0

There are 0 best solutions below