Accentuated characters

A place for users and developers of the Xataface to discuss and receive support.

Postby ferrante » Wed Aug 02, 2006 8:44 am

Hi.

I am developing a small database application for my lab. Here we all speak Spanish, so much of the text have accentuated characters (‡-œ and –). However, I have found an odd behavior when I use accentuated characters. Instead of showing them as such, Dataface replaces them with ? signs, and if I edit the registry and do not change it, Dataface stores them as �.

An example:
I type 'camale—n' and hit enter to save the registry.
The application shows 'camale?n'.
If I save the registry again, it then shows 'camale�n'.

It is odd, because I started using Dataface 0.5.3r2, and it worked. In fact, I noticed the problem after switching to 0.6. The funny thing is that these characters seem to be correctly stored in the database (checked with phpmyadmin), and if I force the browser to use ISO-8859-1 encoding or similar (the browsers switch to UTF-8 as expected when viewing Dataface pages), the characters are showed correctly. I have tried changing the character set of the database to utf8, but no difference.

I think that Dataface is showing the content of the fields as ISO-8859-1, but displaying the rest as UTF-8. I have tried creating a new application, just in case I had altered anything in the old one, but with the same results.

By the way, Dataface is the coolest thing I have found to develop database frontends (even for my lack of knowledge on PHP and SQL). 0.6 is really great. Thank you!

Felipe
ferrante
 
Posts: 12
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Wed Aug 02, 2006 8:56 am

Hi Thanks for pointing this out. You need to make a small change to the Dataface/templates/Dataface_Main_Template.html file to make this work properly. (the change will be included in the next minor release).

Just after the license etc.. you will find a line:


Change it to:

--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby ferrante » Wed Aug 02, 2006 9:25 am

Hi,
Thank you for your fast answer, but there is no change. Whenever I include a non-ASCII character, it is showed as ? (�;).

I have no clue... :(
ferrante
 
Posts: 12
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Wed Aug 02, 2006 9:51 am

Funny, that fixed it on my end.

When you load your page, check the source code (view source). The charset encoding should appear in 2 places:

1. At the beginning:

2.
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Wed Aug 02, 2006 10:01 am

The other thing now that could be causing the problem is that you mentioned that you changed the database encoding to UTF-8. Try changing it back to ISO-Latin-1.

Dataface is designed to use UTF-8 for multilingual sites and IS0-8859-1 (i.e. ISO-Latin-1) for standard single language sites. Unless multilingual content is turned on (which you shouldn't need to) it expects to get ISO-Latin-1 back from the DB. It looks like your DB is producing UTF-8 but Dataface is telling the browser that it is sending ISO-Latin-1, so the browser gimps it up.

i.e. Changing your DB encoding back to ISO-Latin-1 will likely fix this issue.

-Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby ferrante » Wed Aug 02, 2006 5:14 pm

Hi,

OK, I found the source of the problem. I just added default_charset = "iso-8859-1" to my php.ini, and everything worked.

In fact, I reverted the change in Dataface_Main_Template.html and it kept working right. Frankly, I cannot say what is happening. And yes, page source was correct, just like you indicated it should be. I even saved some pages as html, reloaded, and everything was OK; the browser (I tried Safary and Firefox) chose the proper charset. But when I loaded the pages from the server, the browser always selected UTF-8 (yes, I tried everything with the database and the mysql server).

Thank you
ferrante
 
Posts: 12
Joined: Wed Dec 31, 1969 5:00 pm

default_charset = "iso-8859-1"

Postby ADobkin » Sat Nov 03, 2007 8:21 pm

Sorry to resurrect such an old thread, but I had this exact same problem with a new application using Dataface 0.7.1. Everything is basically Latin-1 in my situation, but I had special characters such as ™ and bullet symbols that were showing up as gibberish in Dataface. They showed up perfectly fine in phpMyAdmin, and the charsets in the HTML source already showed ISO-8859-1. However, the Character Encoding in Firefox when I loaded the page was detected as Unicode (UTF-8). If I manually changed it to Western (ISO-8859-1), the symbols appeared correctly.

Looking further, this setting appears to have come from the HTTP response headers:

Code: Select all
Content-Type: text/html; charset=UTF-8


So, even though the HTML specified ISO-8859-1, the web server (Apache) was apparently over-riding it with UTF-8. According to my Apache httpd.conf file (this is the default setting on Red Hat / CentOS / Fedora systems):

Code: Select all
#
# Specify a default charset for all content served; this enables
# interpretation of all content as UTF-8 by default.  To use the
# default browser choice (ISO-8859-1), or to allow the META tags
# in HTML content to override this choice, comment out this
# directive:
#
AddDefaultCharset UTF-8


After finding this post, I added the default_charset = "iso-8851-1" setting. I put it at the top of my Dataface application's index.php file instead of php.ini, as follows:

Code: Select all
ini_set('default_charset','iso-8859-1');


That one change fixed everything. Note: I have not used the oe and ie settings in conf.ini, so they should have already been set as the default (ISO-8859-1).

This tip was very helpful in my case, so hopefully this post will help someone else too.
ADobkin
 
Posts: 195
Joined: Mon Oct 22, 2007 7:31 pm
Location: Atlanta, GA, USA


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 25 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved