CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Accents in MS Access attribute displayed as empty field in Grid

Print topic Send  topic

Author Message
bballesta

Posts: 8
Posted: 03/13/2013, 9:32 AM

The occurence of Accentuated caracters in MS Access database string attributes leads to corresponding empty field in Grids.

Configuration used:
-Microsoft Access
-Encoding all set to UTF-8
-PHP
-Access data base connection using OLEDB abd connection string works
-IIS SERVER

Investigations in GRIDS:

-MS Access seems to be using Windows-1252 coding internally

-The problem seems to be in common.php file:
--function CCToHTML($Value)
--{
-- return htmlspecialchars($Value);
--}
-- The 'htmlspecialchars' function returns an empty string when the given string contains accentuated characters.

-I found a non satisfactory work around to transcode from 'WINDOWS-1252' to 'UTF-8'
--function CCToHTML($Value)
--{
-- // Transcode from 'WINDOWS-1252' to 'UTF-8' ;
-- // http://stackoverflow.com/questions/1523460/ensuring-valid-utf-8-in-php
-- return iconv('WINDOWS-1252', 'UTF-8//TRANSLIT', $Value);
--}

That solution displays the accents in grid fields.

How to I acheive the same result using parameters in CodeCharge instead of falling to custom PHP code?

Best regards
Bernard
View profile  Send private message
DataDoIT
Posted: 03/13/2013, 10:47 AM

In your project settings, make sure your Encode Extension is set to
either iconv or mb, and then make certain that whichever you choose the
appropriate module is actually installed and enabled.

You can verify it's installed by looking at your phpinfo().
bballesta

Posts: 8
Posted: 03/13/2013, 12:27 PM

I have tried both iconv and mb without results.

In phpInfo() references are made to ISO-8859-1 encoding:

iconv.input_encoding ISO-8859-1 ISO-8859-1
iconv.internal_encoding ISO-8859-1 ISO-8859-1
iconv.output_encoding ISO-8859-1 ISO-8859-1

Do I have to change this encoding?
View profile  Send private message
bballesta

Posts: 8
Posted: 03/13/2013, 12:54 PM

To summarise my question:

Database uses its own encoding.

HTML Pages its own encoding.

Both encoding are différents.

I do not see where in the project to specify the database encoding?

Does the generated code find the database encoding itself by testing the characters code?
View profile  Send private message
andrea

Posts: 18
Posted: 05/29/2013, 6:46 AM

I had the same problem: same code working on 2 servers and not on a newer one.
It turned out that PHP changed the default encoding for htmlspecialchars.

From PHP manual:
Quote :
encoding
Defines encoding used in conversion. If omitted, the default value for this argument is ISO-8859-1 in versions of PHP prior to 5.4.0, and UTF-8 from PHP 5.4.0 onwards.


The solution I applied was to modify CCToHTML to
function CCToHTML($Value) {  
   return htmlspecialchars($Value,ENT_COMPAT | ENT_HTML401,'ISO-8859-1');   
}

Now it works perfectly on all servers.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.