If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Weird behaviour with extended characters

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-01-05, 12:46
cdechery cdechery is offline
Registered User
 
Join Date: Sep 2003
Location: Rio de Janeiro, Brazil
Posts: 4
Unhappy Weird behaviour with extended characters

Some of the text retrieved from the database (either from varchar columns or via 'SHOW COLUMNS' from which I extract the possible ENUM values), with extend characters (such as ã or ç) are showing as "???".

I have no idea why this happens. It has no pattern for this behaviour.

First I tought it had something to do with characters sets and collation settings, so I've tried fixing it, but it wasn't it (the default character set - latin1 - is correct, and the collation has nothing to do with, so I figured a little bit later).

I have 96 tables in my database, and this is happening in two of them. They are NOTHING like one another.

the first:
CREATE TABLE `SCA_Grupo` (
`nu_grupo` int(10) unsigned NOT NULL auto_increment,
`cd_sistema` char(3) collate latin1_german1_ci NOT NULL default '',
`nm_grupo` varchar(60) collate latin1_german1_ci NOT NULL default '',
`ds_grupo` varchar(255) character set latin1 NOT NULL default '',
PRIMARY KEY (`nu_grupo`,`cd_sistema`),
KEY `cd_sistema` (`cd_sistema`),
KEY `nu_grupo` (`nu_grupo`,`cd_sistema`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci

the other one:
CREATE TABLE `GPC_PadraoProjecao` (
`id_padrao` int(11) NOT NULL auto_increment,
`vl_pct_juros` decimal(11,8) default NULL,
`dt_vigencia` varchar(40) character set latin1 default NULL,
`vl_indice_correcao` decimal(11,8) default NULL,
`dt_correcao` varchar(40) character set latin1 default NULL,
`vl_pct_considerado` decimal(11,8) default NULL,
`id_regra` int(11) NOT NULL default '0',
`tp_juros` enum('Simples','Composto') character set latin1 NOT NULL default 'Simples',
`nm_origem_pedido` enum('Carvalho','ENCOL','Simulação') collate latin1_german1_ci NOT NULL default 'Carvalho',
PRIMARY KEY (`id_padrao`),
KEY `id_padrao` (`id_padrao`),
KEY `id_regra` (`id_regra`),
KEY `dt_vigencia` (`dt_vigencia`),
KEY `dt_correcao` (`dt_correcao`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci

In the first table all the extended characters in the nm_grupo and ds_grupo come out as "?". In the second table, when I extract the enum values to show them in a combo-box, the value 'Simulação' come out as 'Simula????o'.

I'm using Java and already downloaded the latest version of the driver.

ANY CLUES? Thanks in advance.

Christian

Last edited by cdechery; 02-01-05 at 13:28.
Reply With Quote
  #2 (permalink)  
Old 02-01-05, 13:30
skinnywhitegeek skinnywhitegeek is offline
Registered User
 
Join Date: Jan 2002
Location: Nottingham, UK
Posts: 37
unicode vs latin1

I recently had a similar problem trying to use Coldfusion to input data to mysql tables, and discovered that Coldfusion character set is unicode, while default charset for mysql is latin1 (ISO-8859-1). I believe Java native character set is also Unicode, so if you're using java to get data into the mysql db, you have to find a way to convert extended characters from unicode set to latin1 set before performing the insert. Unfortunately, I don't know what is available for Java in order for you to do this. Hopefully my response can point you in the right direction.
__________________
----
system:
Mac Powerbook 1GHz
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On