Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003
    Location
    Rio de Janeiro, Brazil
    Posts
    4

    Unhappy Unanswered: 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 14:28.

  2. #2
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •