|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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 "?"
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 10:00:01 2025 UTC |
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.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