Re: CHAR field with charset UTF8 and COLLATION UNICODE_CI_AI or UTF8PHP is loading white spaces

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For 30 days, I avoided opening as a bug, because I researched a lot, I
asked in some forums with more than 50 thousand users and I did not find
anyone else with this problem, so much so that in the initial post, I asked
if it could be a configuration problem, or bug or lack of full UFT8 support
with Firebir CHAR fields.

Since there was no answer here on the list, I was feeling alone and afraid
and wondering why no one else has this problem.

Environment test
Windows 10
PHP 7.1.0RC5+ x64 VC14 TS
Apache Lounge 2.4.23 x64 VC14
firebird 3.0.1 x64

configuration
php.ini
    default_charset = "UTF-8"
PHP script file with the test in UFT-8



Example
CHAR SIZE 1
in the database
    'S'
In php results
    'S   ' instead of 'S'
vardump (char_field)
string (4) "S   "

(The issue is the same on ibase_query as PDO)

IMPORTANT
To isolate de problem, all create and insert were executed by isql


ALL DDL

DDL for all 5 collates

http://pastebin.com/0dK6xqS5



script test php

http://pastebin.com/ZRmMRiDy



script test php with PDO

http://pastebin.com/r7rErRyS

2016-11-22 10:05 GMT-02:00 Christoph M. Becker <cmbecker69@xxxxxx>:

> On 22.11.2016 at 12:27, Delmar Wichnieski wrote:
>
> > This issue also occurs with folow PHP versions (for any collate - UTF8)
> > PHP 7.0.12+
> > PHP 7.1.0 RC4+
> > Firebir 2.5.5 + and Firebird-3.0.1.32609_0_x64
> > I have no test with other versions.
> >
> >
> > The driver could map the SQLVARs of SQL_TEXT to SQL_VARYING and adjust
> > offsets and lengths?
> >
> > Or else it has to do the manual work of identifying the charset (UTF8 =
> > number 4) and get byte by byte by mounting the string disregarding the
> > extra spaces.
> >
> > How to resolve without using trim or could there be a fix for an upcoming
> > release if the drive is not able to work with CHAR fields in UTF8?
> >
> > 2016-10-21 10:24 GMT-02:00 Delmar Wichnieski <delmar.delmar@xxxxxxxxx>:
> >
> >> Subject:
> >> CHAR field with charset UTF8 and COLLATION UNICODE_CI_AI or UTF8 PHP is
> >> loading white spaces
> >> Example
> >> 'S   ' instead of 'S'
> >>
> >> Environment
> >> Windows 10
> >> PHP 7.0.12 x64 VC14 TS
> >> Apache Lounge 2.4.23 x64 VC14
> >> firebird 2.5.5
> >>
> >> configuration
> >> php.ini
> >>     default_charset = "UTF-8"
> >> connection to the database
> >>     ibase_connect ( "localhost:" DB, user, pw, "UTF8".
> >> connection PHP script file in UTF-8
> >> PHP script file with the test in UFT-8
> >> response header
> >>    Content-Type: text / html; charset = UTF-8
> >> file.html
> >>     <meta charset="UTF-8">
> >>
> >> Migration in Firebird 2.5.5 charset ISO8859_1 collate PT_BR to UTF8 and
> >> UNICODE_CI_AI (firebird 2.5.5)
> >>
> >> DDL
> >>
> >> SET SQL DIALECT 3;
> >>
> >> SET NAMES UTF8;
> >>
> >> SET CLIENTLIB 'C:\Program Files\Firebird\Firebird_2_5_5\
> >> WOW64\fbclient.dll';
> >>
> >> CREATE DATABASE 'D:\MYDB_UTF8.FDB'
> >> USER 'SYSDBA' PASSWORD 'A'
> >> PAGE_SIZE 4096
> >> DEFAULT CHARACTER SET UTF8 COLLATION UNICODE_CI_AI;
> >>
> >> CREATE TABLE USUARIO (
> >>     CODIGO         INTEGER NOT NULL,
> >>     USUARIO        VARCHAR(20) CHARACTER SET UTF8 NOT NULL COLLATE
> >> UNICODE_CI_AI,
> >>     SENHA          VARCHAR(10) CHARACTER SET UTF8 NOT NULL COLLATE
> >> UNICODE_CI_AI,
> >>     CODCIDADE      INTEGER,
> >>     ACESSOSISTEMA  CHAR(1) CHARACTER SET UTF8 COLLATE UNICODE_CI_AI,
> >>     CPF            VARCHAR(12) CHARACTER SET UTF8 COLLATE UNICODE_CI_AI
> >> );
> >>
> >>
> >>
> >> Example
> >> CHAR SIZE 1
> >> in the database
> >>     'S'
> >> In php results
> >>     'S   ' instead of 'S'
> >> vardump (char_field)
> >> string (4) "S   "
> >>
> >> (Both ibase_query as PDO)
> >>
> >> Its a configuration problem, bug or not full support to UFT-8?
>
> On a quick glance, it seems this issue has been reported as bug, see
> <https://bugs.php.net/bug.php?id=69347>.
>
> --
> Christoph M. Becker
>
>

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux