php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10326 Error while inserting cyrillic symbols into database
Submitted: 2001-04-14 10:46 UTC Modified: 2002-08-13 23:03 UTC
From: flying at dom dot natm dot ru Assigned:
Status: Not a bug Package: InterBase related
PHP Version: 4.0.4 OS: Windows NT4 SP6
Private report: No CVE-ID: None
 [2001-04-14 10:46 UTC] flying at dom dot natm dot ru
Environment:
  Windows NT 4.0 SP6
  PHP v4.0.4 (binaries from www.php.net)
  InterBase v6.0.0.627
  Apache v1.3.17

 The following is metadata for simple InterBase database and short script that tries to insert a range of symbols into this database.
 All works ok while inserting symbols with codes lower than 128, but for all symbols with codes greater than 128 (included cyrillic symbols in windows-1251 code page with codes in range 192..255) the following error is received:

Warning: InterBase: arithmetic exception, numeric overflow, or string truncation Cannot transliterate character between character sets in d:\web\dom\test\qqq.php on line 7

 Note, that nothing is actually inserted into database. Executing the same query directly into InterBase causes data to be inserted properly

Database metadata:
==================
SET SQL DIALECT 3;

SET NAMES WIN1251;

CREATE DATABASE 'D:\db\base.gdb' USER 'user' PASSWORD 'password'
PAGE_SIZE 4096
DEFAULT CHARACTER SET WIN1251;

CREATE GENERATOR GEN_TEST_ID;
SET GENERATOR GEN_TEST_ID TO 0;

CREATE TABLE TEST (
    ID INTEGER NOT NULL,
    TEXT VARCHAR(100));


SET TERM ^ ;

CREATE TRIGGER TEST_BI FOR TEST
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  IF (NEW.ID IS NULL) THEN
    NEW.ID = GEN_ID(GEN_TEST_ID,1);
END
^

SET TERM ; ^

Test PHP script to reproduce bug:
=================================
<?php
    $ib = ibase_connect("d:\\db\\base.gdb" , "user", "password");
    for ($i=60;$i<256;$i++)
    {
        $sql = "INSERT INTO TEST (TEXT) VALUES ('".chr($i)."');";
        echo $sql."<br>";
        $query = ibase_query($ib,$sql);
    };
    ibase_close($ib);
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-15 16:53 UTC] mikep at kaluga dot org
try to specify the codepage in ibase_connect:
ibase_connect($dbase,$usr,$pswd,'WIN1251')
or other you like...
it worked fine for me....
 [2002-08-13 23:03 UTC] kalowsky@php.net
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php

Thank you for your interest in PHP.

As per other user comment
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 09:01:26 2024 UTC