Bug #79217 [Opn]: Last character of a UTF-8 string gets messed up

From: Date: Tue, 04 Feb 2020 13:09:26 +0000
Subject: Bug #79217 [Opn]: Last character of a UTF-8 string gets messed up
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-225346@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79217&edit=1

 ID:                 79217
 User updated by:    steve dot lloyd at gmail dot com
 Reported by:        steve dot lloyd at gmail dot com
 Summary:            Last character of a UTF-8 string gets messed up
 Status:             Open
 Type:               Bug
 Package:            ODBC related
 Operating System:   Centos
 PHP Version:        7.3.14
 Block user comment: N
 Private report:     N

 New Comment:

PDO has the same problem.

test script:
--------------------
try {
	$pdo = new PDO("odbc:{$datasource}",$username, $password);
	$query = "select * from sltschema.t141t";
	$poo = $pdo->prepare($query);
	$poo->execute();
	$row = $poo->fetch(PDO::FETCH_ASSOC);
	print_r($row);
} 
catch (PDOException $e) {
  echo "Connection failed : ". $e->getMessage();
}

Result:
---------------
Array
(
    [MANDT] => 000
    [SPRAS] => 1
    [MMSTA] => 01
    [MTSTB] => 因采购/仓库而被冻tc
    [ZMODIFIEDTS] => 20200131152705439
    [ZMODIFIEDTS_TEST] => 2020-01-31 15:27:05.4380000a
)
--------------------------

The bug you referred to seemed to say this was patched but it is still an issue in PHP 7.4.  How do
I patch/resolve this issue?


Previous Comments:
------------------------------------------------------------------------
[2020-02-04 08:56:37] cmb@php.net

This seems to be related to bug #44278.

Can you try basically the same script with PDO_ODBC instead?

------------------------------------------------------------------------
[2020-02-03 22:06:52] steve dot lloyd at gmail dot com

Description:
------------
Last character of a UTF-8 string gets messed up.  See stackoverflow URL in Test Script section.  I
have tried this with multiple PHP versions.  I have concluded it must be an issue with PHP ODBC
functions as it works fine in other languages (python, isql).

Test script:
---------------
https://stackoverflow.com/questions/59904479/last-character-issue-with-sap-hana-utf8-on-php

Expected result:
----------------
因采购/仓库而被冻结
因任务清单/BOM而被冻结
MPN:BOM抬头冻结
gesp. für Besch./Lager
gesp. für Arb.plan/Stückl

Actual result:
--------------
因采购/仓库而被冻ad
因任务清单/BOM而被ader
MPN:BOM抬头冻结
gesp. für Besch./Lager
gesp. für Arb.plan/Stüca


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=79217&edit=1


Thread (11 messages)

« previous php.bugs (#225346) next »