[Gambas-user] gb.db (Charset)

David Villalobos Cambronero david_villalobos_c at ...43...
Fri Oct 26 14:33:22 CEST 2007


Well, first that ofall, thank you very much for your information, now I have clear how the things work.

In the first mail I believe that I forgot to mention that I have not had problems with the storage of special characters, only that seemed to me to be very strange that the charset was in latin1.

My predetermined language is es_ES, and Spanish has many special characters, and the truth there does no seem to be a problem.

I believe that is better to have clearly why things happen.

Once again.... thanks

David


----- Original Message ----
From: Benoit Minisini <gambas at ...1...>
To: mailing list for gambas users <gambas-user at lists.sourceforge.net>
Sent: Friday, October 26, 2007 5:31:37 AM
Subject: Re: [Gambas-user] gb.db (Charset)


On vendredi 26 octobre 2007, Benoit Minisini wrote:
> On mercredi 24 octobre 2007, Benoit Minisini wrote:
> > On mercredi 24 octobre 2007, David Villalobos Cambronero wrote:
> > > Hi all,
> > >
> > >     One of these days I realised somethig interesting. I use
 MySQL
> > > version 6.0, and I create my databases manually, I mean, I don't
 use
> > > gambas-database-manager for that. All my databases uses UTF-8,
 but when
> > > I see the values in the connection, the property Charset has the
 value
> > > "latin1", this property has to be UTF-8, right?
> > >
> > >     I haven't  any problem with this, but to me, it seems a bug.
 By the
> > > way I use Mandriva 2007.1 and Gambas 1.9.90.
> > >
> > > Regards
> > >
> > > David
> >
> > Right, I noticed the same problem with MySQL 5 on Mandriva 2008.
> >
> > I think that the database client tells by default to the server
 that it
> > want "latin1", even if the server uses UTF-8!
> >
> > But I must investigate to understand what happens really.
> >
> > Regards,
>
> Well, on Mandriva 2008 it seems that the mySQL server cannot be
 switched
> to "UTF-8", and that the client cannot change its character set to
 "UTF-8"
> (with the mySQL SQL command 'SET NAMES'). "UTF-8" is a unknown
 character
> set... So t seems logical that the client charset is "latin1".
>
> According to the documentation, when the client connect, it gets by
 default
> the default charset of the server, which should be UTF-8 in your
 case. So I
> don't see how you can get "latin1". What happens if you connect to
 your
> UTF-8 server with the mysql command? Do you have latin1 as default
> character set? What is the default charset of the OS ($LANG
 variable)?

Oops. I was wrong. It is just a matter of using "UTF8" and not "UTF-8".
 So 
weird...

But apparently "latin1" is the default character set, even if my system
 is set 
to UTF-8.

As for what value should have DB.Charset, it depends on your point of
 view:

* You can keep the default. Note that DB.Charset is not the charset of
 the 
database, but the charset of the connection. Keeping the default is
 easier, 
as then the code does not depend on the database backend: it does
 nothing :-)

* You can use the server database charset.

* You can use the charset of the client OS.

I find the last the more logical. After all, if the current charset of
 OS 
is "XYZ", you would like the database server to talk to you with the
 same 
charset.

Note that changing the charset is not possible in all database
 backends, and 
is not supported by the database component at the moment. And that you
 can 
issue a MySQL SQL command if you really need a specific charset.

Tell me what you think about that...

Regards,

-- 
Benoit Minisini

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Gambas-user mailing list
Gambas-user at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user





__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the User mailing list