php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41533 function dbase_get_record_with_names doesnt read special characters
Submitted: 2007-05-29 21:38 UTC Modified: 2007-05-30 15:11 UTC
From: jprolando at gmail dot com Assigned:
Status: Not a bug Package: dBase related
PHP Version: 5.2.3RC1 OS: Windows XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jprolando at gmail dot com
New email:
PHP Version: OS:

 

 [2007-05-29 21:38 UTC] jprolando at gmail dot com
Description:
------------
Excuse me for my english

I get data from a dbase database and special characters like ? or ? are changed by the function "dbase_get_record_with_names".

Ive tried to use Code Headers function UTF8_encode UTF8_decode and that doesnt seem to solve the problem.

Reproduce code:
---------------
<?php
//header('Content-Type: text/html; charset=iso-8859-1');
include ('config.php'); 
$link = conectar_BD(); 
$db = dbase_open('ART1.DBF', 0); 
if ($db) { 
  $numero_registros = dbase_numrecords($db); 
  for ($i = 1; $i <= $numero_registros; $i++) { 
     $row = dbase_get_record_with_names($db, $i);       
	 $codigoweb1 = $row['CODIGOWEB1'];
	 $codigoweb2 = $row['CODIGOWEB2'];
	 $codigo = $row['CODIGO'];
	 $articulo = $row['ARTICULO'];           
        echo "Linea ($i):-->  " . $row['ARTICULO'] . "</br>"; 
  } 
} 
?> 


Expected result:
----------------
The Function should display the "?" and "?" characters correctly in my web browser

Actual result:
--------------
"?" displays as "?" and "?" as "?"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-29 21:41 UTC] tony2001@php.net
Are you sure the database really contains those characters (and not the broken ones)? Did you check it? How?

 [2007-05-30 12:59 UTC] jprolando at gmail dot com
Well, the database is being used in my bussines, and Im sure those characters are displayed correctly. Besides I load the database on acces and the special characters show up correctly.

Here is a screenshots of the database being used in access

http://www.hartley.edu.uy/caracteresacces.bmp
 [2007-05-30 13:05 UTC] tony2001@php.net
Ok, so what are these characters? Some unicode ones?
Then I guess you need to set appropriate encoding of the page to see them.
 [2007-05-30 13:15 UTC] jprolando at gmail dot com
Those Characters are iso-8859-1 they are characters that are used in spanish. Also when i load dbase database on MS-DOS they also display correctly.

Ive tried using this

<?php
header('Content-Type: text/html; charset=iso-8859-1'); ...

and using that charset it should work fine.
 [2007-05-30 13:25 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2007-05-30 13:57 UTC] jprolando at gmail dot com
Script is the following one:

<?php
header('Content-Type: text/html; charset=iso-8859-1');
$db = dbase_open('ARTD.DBF', 0); 
if ($db) { 
  $numero_registros = dbase_numrecords($db); 
  for ($i = 1; $i <= $numero_registros; $i++) { 
     $row = dbase_get_record_with_names($db, $i);       
	 $articulo = $row['DETALLE5'];           
        echo "Linea ($i):-->  " . $row['DETALLE5'] . "</br>"; 
  } 
} 
?>

you can get the database in the following adress:
http://www.hartley.edu.uy/ARTD.DBF

thanks
 [2007-05-30 14:28 UTC] tony2001@php.net
I get the very same result using dbview, hence it doesn't seem to be PHP problem.
You should not be using DBF anyway, there are plenty of real databases.
 [2007-05-30 15:11 UTC] jprolando at gmail dot com
I understand you what you said, but the function you did to me not solve my problem.
We are migrating from DBF to MySql, so the problem.
Is there another way to solve it, without leaving DBF, with PHP?
It seems to me your function is not an universal one... It doesn't work properly everytime, everyway
I appreciate your time, thank you very much.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 18:01:28 2024 UTC