Professional Web Applications Themes

GB2312 Continues to flummox - Macromedia ColdFusion

Well after finally getting the JVM to work with GB2312 encoding by removing the i18n.jar file from runtime (nice tip Hiroshi!). My data is not being stored in the mysql DB correctly. I have the connection string ?useUnicode=True&characterset=GB2312 set up for the dsn which is mysql 4.1 and shows GB2312 as an installed cht, but I'm getting lots of ???? chars Boy this is sure fiddly, anyone got tyhis working who can take me through the config? thanks...

  1. #1

    Default GB2312 Continues to flummox

    Well after finally getting the JVM to work with GB2312 encoding by removing the
    i18n.jar file from runtime (nice tip Hiroshi!). My data is not being stored in
    the mysql DB correctly. I have the connection string
    ?useUnicode=True&characterset=GB2312 set up for the dsn which is mysql 4.1
    and shows GB2312 as an installed cht, but I'm getting lots of ???? chars
    Boy this is sure fiddly, anyone got tyhis working who can take me through the
    config? thanks

    nowski Guest

  2. #2

    Default Re: GB2312 Continues to flummox

    if you're using the newer jdbc driver try [url]http://www.markme.com/cantrell/archives/007078.cfm[/url].

    PaulH Guest

  3. #3

    Default Re: GB2312 Continues to flummox

    PaulH, once again you are on the case! I'll give that a go, but I'm not clear where the jdbc string is!

    Any clues?
    nowski Guest

  4. #4

    Default Re: GB2312 Continues to flummox

    if you're using the new JDBC driver you have to add it to cf as an "other" (and d/l the new driver from mysql). there will be a 'jdbc url' on the form for that.
    PaulH Guest

  5. #5

    Default Re: GB2312 Continues to flummox

    Oh dear, I'm afraid that one doesnt solve it. The new driver works fine but
    when I append the connection string to the jdbc url it throws an error on
    insert. Data truncated for column 'story' at row 1 In the connection string
    form field, it works, only I get ????? again. String I'm using:
    ?useUnicode=true&characterEncoding=gb2312 I also tried:
    ?useUnicode=true&characterEncoding=UTF8 The DSN verifies fine though , so
    that's something.

    nowski Guest

  6. #6

    Default Re: GB2312 Continues to flummox

    let's review: when you built the table, you used the gb2312 cht? your tests after fixing the i18n.jar issue was w/the old jdbc driver (labelled mysql), not ODBC? adding gb2312 text failed?
    PaulH Guest

  7. #7

    Default Re: GB2312 Continues to flummox

    Yep, built DB - I _think_ I did it as UTF8 originally, then altered it to
    GB2312, tests after fixing the jar file was with default myslq driver yep,
    then added the new one both with connection string. Maybe I should create a
    new DB from scratch?

    nowski Guest

  8. #8

    Default Re: GB2312 Continues to flummox

    a new table at least. btw i just noticed that your connection string uses "characterset", shouldn't that be "characterEncoding"?
    PaulH Guest

  9. #9

    Default Re: GB2312 Continues to flummox

    Ok, so I dropped the table and recreated it from the sql script (see code). I'm
    still not getting the result I need though. The connection string thing is as
    it should be (mis quoted in my previous post) Still wont work in the jdbc url
    form though, only in the connection string entry. Boy, this is frustrating! I
    wonder if my table structure is ok? Do the field datatypes need to be different
    for double-byte data perhaps?

    CREATE TABLE `news_items` (
    `newsid` int(11) NOT NULL auto_increment,
    `mankey` int(11) default NULL,
    `manid` int(11) default NULL,
    `catid` int(11) default NULL,
    `modelid` int(11) default NULL,
    `ntype` varchar(50) character set latin1 default NULL,
    `headline` varchar(255) character set latin1 default NULL,
    `strap` varchar(255) character set latin1 default NULL,
    `shortquote` varchar(255) character set latin1 default NULL,
    `story` longtext character set latin1,
    `url` varchar(255) character set latin1 default NULL,
    `dl1` varchar(100) character set latin1 default NULL,
    `dl2` varchar(100) character set latin1 default NULL,
    `email` varchar(50) character set latin1 default NULL,
    `cdate` datetime default NULL,
    `pic1` varchar(100) character set latin1 default NULL,
    `pic2` varchar(100) character set latin1 default NULL,
    `pic3` varchar(100) character set latin1 default NULL,
    `text1` varchar(255) character set latin1 default NULL,
    `num1` int(11) default NULL,
    `views` int(11) default NULL,
    `synthid` int(11) default NULL,
    `rrp` varchar(100) character set latin1 default NULL,
    `release` datetime default NULL,
    `active` int(11) default NULL,
    `vid` varchar(100) character set latin1 default NULL,
    `aud` varchar(100) character set latin1 default NULL,
    `ialign` char(1) character set latin1 default NULL,
    `icaption` varchar(255) character set latin1 default NULL,
    `moviefile` varchar(255) character set latin1 default NULL,
    `mcaption` varchar(255) character set latin1 default NULL,
    `userid` int(11) default NULL,
    `postedby` varchar(50) character set latin1 default NULL,
    `summary` mediumtext character set latin1 NOT NULL,
    `livedate` datetime default NULL,
    `m_status` int(11) NOT NULL default '0',
    PRIMARY KEY (`newsid`)
    ) ENGINE=MyISAM DEFAULT CHT=gb2312;

    nowski Guest

  10. #10

    Default Re: GB2312 Continues to flummox

    so the voodoo problems are now all solved?

    PaulH Guest

  11. #11

    Default Re: GB2312 Continues to flummox

    Current stae is, new DB structure means that I CAN now use the jdbc connection
    string format and it appears to insert ok. I don't have a GB2312 machine, but
    my translator is going to test it hopefully today and get back to me, but it
    certainly looks much more promising. I will post a summary and mark as answered
    should it be ok. Thanks for everyones help, hopefully this thread will be of
    some use to others in the same boat (and with my level of non -knowledge!)

    nowski Guest

  12. #12

    Default Re: GB2312 Continues to flummox

    any browser should do for testing, just set the encoding on your pages & make sure the browser swaps to it.

    "sounding like a broken record" but i think you can just as easily use unicode for this.
    PaulH Guest

Similar Threads

  1. pageencoding=gb2312 errors
    By nowski in forum Macromedia ColdFusion
    Replies: 16
    Last Post: May 31st, 03:37 AM
  2. How to covert GB2312 to UTF-8 in php?
    By Lian Liming in forum PHP Development
    Replies: 0
    Last Post: February 20th, 03:27 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139