MySQL wierd characters

Hi there!
I'm start using ColdFusion and whant to use MySQL DataBase.
I have a MySQL (3.x) Datan Source Connection configured on
the ColdFusion server.
On DreamWeaver I can access and retreive all the tables data
but with a strange behavior.
All values with "ç,´. ~, ^" are represented with
wierd characters loke "_" and squares.
I use the same MySQL table with PHP and it work just fine,
just when i call the table data in ColdFusion that i have that
problem.
How can I solve this??? :\
Thanks in advance...

it all depends on what collation(s) the tables/fields in your
MySQL
database use...
you will probably have to include a <cfprocessingdirective
pageencoding="[characterencodinggoeshere, i.e. utf-8]
(obviously without
the brackets)"> at the top of each page you display your
db data on...
you may also have to upgrade to a later MySQL driver than the
one
shipped with CF if you are using utf-8 encoding (mysql3.x
drivers
shipped with cf are cr@p at dealing with utf-8 encoded
data...)
again, depending on your data encoding in your db you may
have to use
<cffscript>
SetEncoding("form","[characterencodinggoeshere, i.e. utf-8]
(obviously
without the brackets)");
SetEncoding("url","[characterencodinggoeshere, i.e. utf-8]
(obviously
without the brackets)");
</cfscript>
and
<cfcontent type="text/html;
charset=[characterencodinggoeshere, i.e.
utf-8] (obviously without the brackets)">
in your Application.cfm/cfc...
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Similar Messages

  • MySQL Japanese characters

    Hello,
    I already searched the froums for a soluton to my problem but couldn't find any for it though I tried some of the things that were proposed. I have a MySQL Database where I store Japanese characters in SJIS. I tested if they are in SJIS and they are.
    I am using mysql 4.1.3b-beta, mysql-connector-java-3.0.14, JBuilderX (jdk 1.4.2), and OS XP.
    When I try to retrieve the data I only get a square, then a some character, then a square, then another character,... but not the actual Kanji/Kana. I can display Japanese characters correctly when I retrieve them from a file, so I don't think it's a problem with the font.
    My code is as follows:
    public void testDB(){
    String result ="";
    Connection con = null;
    Statement st = null;
    try
    Properties prop = new java.util.Properties();
    prop.put("user","");
    prop.put("password","");
    prop.put("useUnicode", "true");
    prop.put("characterEncoding","SJIS");
    String url = "jdbc:mysql://localhost/japanese";
    //Class.forName ("org.gjt.mm.mysql.Driver");
    Class.forName ("com.mysql.jdbc.Driver").newInstance ();
    con = DriverManager.getConnection (url, prop);
    result= "Database connection established";
    st = con.createStatement();
    ResultSet rs = null;
    String querry1 = "SELECT * FROM jp";
    PreparedStatement pstmt = con.prepareStatement(querry1);
    rs = pstmt.executeQuery();
    int i = 0;
    while (rs.next()) {
    result = rs.getString(1);
         jTable1.setFont(new Font("Arial Unicode MS",0,15));
    jTable1.setValueAt(result,i,0);
    i++;
    catch (Exception e)
    // result = "Cannot connect to database server";
    finally
    if (con != null)
    try
    con.close ();
    // result ="Database connection terminated";
    catch (Exception e) { /* ignore close errors */ }
    I hope someone can help me as MySql is my last option after I already discovered that I couldn't use MS Access and Foxpro because the ODBC:JDBC bridge doesn't work correctly for unicode.
    On a side note as I am new to MySql after installing version mysql4.1.3b. I no longer have the mysqld.exe but only mysqld-opt.exe. So I am using this instead. But I don't think that can be responsible for my problem.
    Thaks for any help.
    S

    I see your original question was sent in August so maybe you have found an answer ?.. Would be interesting to see how you fixed it.
    I was having a similar sort of problem but managed to fix it by looking at the fonts available to Java on my machine and setting the font used by the graphics object to one of the japanese fonts. (nb. I see in your code you are setting the font to arial unicode, maybe setting it to a japanaese font name would be enough)
    Hopefully the following will give you some help.
    // this line sticks the name of all fonts in the graphics environment in an array
    String[] nameArray = GraphicsEnvironment
                   .getLocalGraphicsEnvironment()
                   .getAvailableFontFamilyNames();
    // I know that the last two fonts are for japanese characters. I chose the font name second from the end of the array.
    int listfonts=nameArray.length-2 ;
    //then I sent the font for the g2 object.
    Font fontselec ;
    fontselec = new Font(nameArray[listfonts],Font.PLAIN,24) ;
    g2.setFont(fontselec) ;
    best regards
    Graham

  • Wierd characters in LDAP changelog

    Hello,
    We're encountering this wierd problem while running a LDAP activesync. The modifiersname attribute within some changelog entries have some sort of wierd special character in it (it seems to be a carriage return). LDP shows it as some wierd ascii character. This is messing up our activesync runs because it's not filtering the changelog entries based on administrator correctly and therefore sometimes goes into an endless loop. Has anyone else run into a similar issue?

    Regarding the iso-8859-1, I've seen that in other posts regarding this problem.
    No the characters do not appear in the browser when I run it on my desktop. Once again you would think server, but the other projects work on the same server. I just uploaded an older version created with RH5 and it still works properly on the server. Worst comes to worst I will recreate my changes again in the older build. But it looks like RH8 will never create new projects that will work. Only RH5 converted to RH8 work. Figure that one out.
    New info, the plot is thickening...I found this program called Textpad that displays the hidden characters () in the code.  What I learned was that the minute you open an RH5 project in RH8 it converts the pages and adds the characters to every page,   I compared 5 pages of rh5 to rh8.
    Also an interesting fact is that this is the only project I have created by importing the RH5 topics.  All other projects were created in RH5 and then opened/converted into RH8.  Also, the new blank test project I created in RH8 didn't work.
    Another thing I did to troubleshoot. I opened all of the pages and removed the characters by saving them in Notepad++  (Encoding > Convert to UTF-8 without BOM).  They look fine in Textpad but when you look at the generated files the hidden characters are there.
    But back to the part where all projects, including other projects that work have these hidden characters....

  • [mysql] Extra Characters Added

    I've just switched to mySQL from Access. When I add a new
    News Article to the site using my CMS extra characters are added to
    the beginning of the "longtext" columns. You can see it here after
    the published date.
    http://www.ncadfed.org/news/?loc=news&n_id=24
    Does anyone know how to stop this from happening.
    I'm using CFMX6 and mySQL4
    Thanks

    I hope I don't have to do that as I'd have to switch 100
    cfupdates and cfinserts. I'm on shared hosting so I have to use
    mySQL 4 since that is all they offer at this time. I've sent the
    following link to my host with no response, I'm hoping it will fix
    it. I read in a post that it does.
    http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_18952
    Its a hotfix for cfupdate and cfinsert.
    Thanks

  • Files with wierd characters and dated Dec 31, 1903

    My laptop crashed on my last weekend or actually never shutdown properly. After rebooting the computer I had two files on my desktop with weird characters dated Dec 31, 1903. I could select the files and put them in the trash, but they never delete. After rebooting several times the files still appear in the trash but I am unable to delete them. However, once I get info on them, they disappear. Does anyone know what these files are and how I can remove them? I was using iMovie and external disk that I think might have caused a problem, but I'm not sure.
    Thanks!

    You can also:
    *1. go to My Computer*
    *2. right-click on your system drive (usually C:)*
    *3. select properties*
    *4. select the tools tab in the property dialog that pops up*
    *5. click check now button in the top section under Error-checking. This will launch Check Disk.*
    *6. Make sure to check the checkbox for Automatically fix file system errors. Then click the Start button.*
    It will restart your computer to run Check Disk and fix any errors. Once Windows is up again you can go to Boot Camp in the control panel and set OS X to be the startup partition & reboot into OS X. That should get rid of the weird files in your trash.
    MacFixIt has a pages with pretty much the same exact procedure:
    http://www.macfixit.com/article.php?story=20080717113150139&query=bootcamp+trashfiles

  • MySQL: Result characters are all spaces!!!?

    The field names and contents in Table are all English. Can connect to DB, the result row number is right also, but when using getString("name"), the following exception occur:
    SQLException: Column 'name' not found.
    getString(1) can work, but the result string is comprised of spaces, exactly the same length!
    Why?

    my code segment:
    Class.forName("com.mysql.jdbc.Driver");
    con = DriverManager.getConnection("jdbc:mysql:///menagerie");
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery("select * from pet");
    while(rs.next()) {
    System.out.println("Name = " + rs.getString("name") + "<br>");
    Thanks for reply!

  • Get rid of the wierd character \n\r?

    Dear Friends,
    I insert a text data into mysql database as TEXT type. and type some words and press return to go to next line, when I retrieve the data from database, the data shows some wierd characters..like \n\r...How can I get rid of the problem???
    thanks for your help

    I read some posts..and they said just replace \r\n with <br>
    however, I just cannot make the replaceAll("\r\n","<br>") method work...
    it seems a simple problem...but it takes me a long time and doesn't solve it..
    can anyone help me out???

  • JSC, mysql 4.0 data source and utf-8

    Hi all,
    I connected to mysql 4.0 database from JSC and bound some utf-8 encoded text data to a StaticText component in a JSP page. Data is shown improperly, as a bunch of wierd characters.
    MySQL 4.0 knows nothing about encodings other than iso8859-1, afaik, but data is entered as utf-8.
    When I use Eclipse QuantumDB plugin I have the same problem, but when I chose utf-8 encoding, the text shows properly. Similarily, when I use phpmyadmin all is ok after I manually set browser encoding to UTF-8.
    I can't get data to show properly in JDeveloper either.
    Enoding is already set to UTF-8 for pages created in JSC, but that doesn't help.
    Does anyone know how I can fix this? Upgrading to mysql 4.1 is not an option.
    Thanks in advance for any replies.

    Thanks a lot Ridvan :)
    Adding '?useUnicode&characterEncoding=utf8' to the database url solved the problem.
    Thanks again. Cheers.

  • Flat file producing weird characters in a flat file

    I am extracting BLOB Data into a file .Its producing wierd characters in a file.Any help would be appreciated.The code is as follows.
    create or replace PROCEDURE A(product_id in varchar) IS
    vblob BLOB;
    vstart NUMBER := 1;
    bytelen NUMBER := 32000;
    len NUMBER;
    my_vr RAW(32000);
    x NUMBER;
    l_output sys.UTL_FILE.FILE_TYPE;
    BEGIN
    -- define output directory
    l_output := sys.utl_file.fopen('A', 'getPayload8.txt','wb',32760);
    vstart := 1;
    bytelen := 32000;
    -- get length of blob
    SELECT dbms_lob.getlength(BIN) INTO len FROM orabpel.xml_document products WHERE dockey = product_id;
    -- save blob length
    x := len;
    -- select blob into variable
    SELECT BIN
    INTO vblob
    FROM orabpel.xml_document
    WHERE dockey = product_id;
    -- if small enough for a single write
    IF len < 32760 THEN
    utl_file.put_raw(l_output,vblob);
    utl_file.fflush(l_output);
    ELSE -- write in pieces
    vstart := 1;
    WHILE vstart < len and bytelen > 0
    LOOP
    dbms_lob.read(vblob,bytelen,vstart,my_vr);
    utl_file.put_raw(l_output,my_vr);
    utl_file.fflush(l_output);
    -- set the start position for the next cut
    vstart := vstart + bytelen;
    -- set the end position if less than 32000 bytes
    x := x - bytelen;
    IF x < 32000 THEN
    bytelen := x;
    END IF;
    utl_file.fclose(l_output);
    end loop;
    END IF;
    end;

    Surely CLOB data would be what is expected to be written to a text file whereas a BLOB is more likely to be a binary format file of some sort like a JPEG or word .DOC file.It's not actually agree with that suppose. The BLOB objects are used in text file as well as CLOBs in case we need to unload exactly matched structure. What do i mean?! For example, we use CLOB to unload text data into file. In this case the text file itself depends on platform (i.e. byte order, line termination characters).In case of BLOB everything goes exactly as is.

  • Read Russian Characters and compare them.

    All,
    My task is to read an XML file and convert all of the Russian Characters in the file to latin characters. (e.g. &#1076; would be e and &#1078; would be h)
    When I read the Russian Characters I get wierd characters that look like ??. I tried to read the file in as UTF8 but now instead of the wierd characters I get ???? for the characters.
    The input file looks like this.
    <?xml version="1.0"?>
    <russian>
         <para>
              <text>testing</text>
              <ru>&#1080;&#1076;&#1092;&#1088; &#1080;&#1076;&#1092;&#1088; &#1080;&#1076;&#1092;&#1088; &#1080;&#1076;&#1092;&#1088;</ru>
         </para>
         <para><ru>&#1092; &#1090; &#1074;&#1086;&#1076;&#1092;&#1083;&#1074; &#1072;&#1086;&#1092;&#1099;&#1074;&#1076;&#1072;&#1083;&#1092;&#1086; &#1099;&#1074; &#1092;&#1099;&#1076;&#1074;&#1078;&#1083;&#1086;&#1072; </ru></para>
         <ru/>
    </russian>
    When I read it in I get.
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/css" href="test.css"?>
    <russian>
         <para>
              <text>testing</text>
              <ru>???? ???? ???? ????</ru>
         </para>
         <para><ru>? ? ?????? ?????????? ?? ???????? </ru></para>
         <ru/>
    </russian>
    So I can't compare the russian characteres to convert them.
    Is there anyway to read them in and perserve what they are. I don't care what they look like when the come in just that they are distinguishable so I can compare them and change them to the right latin character.
    Thanks for the help.
    Michael

    Thanks for the reply.
    Ok,
    You asked for it so I will give it to you.
    I took your advice and made sure that the encoding was correct. I resaved the xml file as a UTF-8 encoded page in notepad. (It was already UTF8 but I did it anyway) Dreamweaver confirms that the file is indeed of UTF8 encoding. So assuming that if I type in russian letters in notepad and save the file as a UTF8 file then the characters are UTF8.
    So the input file is this.
    <?xml version="1.0" encoding="utf-8"?>
    <?xml-stylesheet type="text/css" href="test.css"?>
    <russian>
         <para>
              <text>testing</text>
              <ru>&#1080;&#1076;&#1092;&#1088; &#1080;&#1076;&#1092;&#1088; &#1080;&#1076;&#1092;&#1088; &#1080;&#1076;&#1092;&#1088;</ru>
         </para>
         <para><ru>&#1040; &#1099;&#1092;&#1083;&#1086; &#1092;&#1074;&#1086;&#1072; &#1092;&#1076;&#1083;&#1099; &#1072;&#1086;&#1078;&#1076;&#1072;&#1074; &#1087;&#1083;&#1086;&#1099;&#1076;&#1072;&#1074;&#1086; &#1087;&#1099;&#1072;&#1087; &#1086;</ru></para>
         <ru/>
    </russian>
    I read in the file using this code.
    BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream("test.xml"), "UTF8"));
                   StringBuffer sb = new StringBuffer();
                   while ((str = in.readLine())!= null){
                        sb.append(str);
                        sb.append(System.getProperty("line.separator"));          
                   theString = sb.toString();
                   System.out.println(theString);
    The System.out.println(theString); outputs this.
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/css" href="test.css"?>
    <russian>
         <para>
              <text>testing</text>
              <ru>???? ???? ???? ????</ru>
         </para>
         <para><ru>? ? ?????? ?????????? ?? ???????? </ru></para>
         <ru/>
    </russian>
    Later on in my program I have an array that compares the russian to the russian character array.
    char[] russianLett = new char[66];
    russianLett[0] = '&#1040;';
    russianLett[1] = '&#1066;';
    russianLett[2] = '&#1042;';
    ETC.... for all capital and lowercase russsian letters.
    So it doesn't find ? in my array and thus returns ?.
    Maybe you can se what is going wrong.
    You can download the code from http://www.michaelsworld.us/misc/project.zip .

  • ZipOutputStream appends characters to beginning of zipped file?

    Hi and thanks in advance for any help!
    I am trying to zip Excel files using ZipOutputStream class. I can open the Excel files fine before I zip. Then I run my program to zip. It seems to work. I use WinZip to unzip and when I try and open unzipped file in Excel, Excel says it does not recognize format. Looking at unzipped file in text editor, about 15 wierd characters and nulls are now appended to the beginning of my Excel file that are not in the original. If I delete them in the text editor, Excel can open.
    Here is my zip code:
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ZipOutputStream zos = new ZipOutputStream(baos);
    ArrayList fileNames = new ArrayList();
    fileNames.add ("91PSAG0Jak.csv");
    fileNames.add ("91I9F60K62.csv");
    // Compress the files
    for (int i=0; i<2; i++) {
    String filename = String.valueOf(fileNames.get(i));
    byte[] file = DatabaseUtilities.downloadFile("pdfstoragedir", filename);
    // Add ZIP entry to output stream.
    zos.putNextEntry(new ZipEntry(filename));
    ObjectOutputStream oos = new ObjectOutputStream (zos);
    oos.writeObject(file);
    oos.flush();
    // Complete the entry
    zos.closeEntry();
    //Complete the ZIP file
    zos.close();
    byte[] zipFile = baos.toByteArray();
    DatabaseUtilities.uploadFile("pdfstoragedir", "zipOutput.zip", zipFile);
    FileOutputStream fos = new FileOutputStream("C:\\zipOutput.zip");
    BufferedOutputStream bos = new BufferedOutputStream(fos);
    bos.write(zipFile, 0, zipFile.length);

    Thanks, I got it I think, I can write my byte[] directly to the zipOutputStream:
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ZipOutputStream zos = new ZipOutputStream(baos);
    ArrayList fileNames = new ArrayList();
    fileNames.add ("8aCeOH0Fba.zip");
    fileNames.add ("8da6S40H4e.zip");
    // Compress the files
    for (int i=0; i<2; i++) {
    String filename = String.valueOf(fileNames.get(i));
    byte[] file = DatabaseUtilities.downloadFile("pdfstoragedir", filename);
    // Add ZIP entry to output stream.
    zos.putNextEntry(new ZipEntry(filename));
    zos.write(file);
    // Complete the entry
    zos.closeEntry();
    //Complete the ZIP file
    zos.close();
    byte[] zipFile = baos.toByteArray();
    DatabaseUtilities.uploadFile("pdfstoragedir", "zipOutput.zip", zipFile);
    FileOutputStream fos = new FileOutputStream("C:\\zipOutput.zip");
    BufferedOutputStream bos = new BufferedOutputStream(fos);
    bos.write(zipFile, 0, zipFile.length);

  • Unable to set Default charset to UTF-8

    So I've added the following to /etc/httpd/conf/httpd.conf:
    AddDefaultCharset utf-8
    Still firefox reports that my phpfiles are using ISO-8859-1 even though defaulcharset and the files encoding is utf-8.
    What am I doing wrong? I converted the file to UTF-8 with notepad++.
    Problem is that Å Ä Ö don't work properly. They never work when echoed from mysql.
    Last edited by XAM (2010-07-02 11:49:19)

    Banton wrote:Have you set <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> in html header?
    Yes, but I've created a phpfile with the following code, nothing else is in the file.
    <?php echo'Å Ä Ö'; ?>
    Does not work, it echoes out wierd characters.
    karol wrote:> They never work when echoed from mysql.
    Are the files generated dynamically? If so, you should check the mysql part.
    mysql is set to utf-8.

  • Issue with setting Polish keyboard.

    Hi,
    I manage to set keyboard in X11 but have an annoying problem. Generally combination of 'Alt + character' should give polish sing, but only for few characters (a,e,o,l,c,n,z,x,). Now it works with each character on my keyboard and gives signs/symbols like:
    ©ßß←↓→þ
    How to stop this, because it's very frustrating. When I made typo during writting I get some wierd characters.

    I have this everywhere. Outout of localectl:
       System Locale: LANG=pl_PL.UTF-8
                      LC_COLLATE=C
           VC Keymap: pl2
          X11 Layout: pl
           X11 Model: pc105

  • Retrieve text entered in web form

    Somebody please offer some assistance here.
    I've lost some important information entered into a web form and simply using the back button will not retrieve it.  I'm hoping it can be retrieved through the cache or form value files somehow but I'm not familiar with these types of files so I'm coming up short.
    Any idea how to retrieve it?

    What is the unary operator (addition, subtraction, never, etc) on the member that represents your text measure?  Is it possible that you're aggregating the numeric data in Essbase that is then referenced to derive the text data (from the Planning repository), and therefore the text measure is returning something at upper levels?
    If that isn't helpful, you could potentially mask the cell using a data validation.  Create a data validation that always evaluates to true, and black-out the one cell you don't want displayed.  Not the best fix, but it will prevent the wierd characters from being displayed.
    Hope this helps,
    - Jake

  • Adobe Form Formatting Problem

    Hi ,
    I am printing a Custom Adobe Form(ZPTRV_EXPENSE_FORM), which is a copy of standard form(PTRV_EXPENSE_FORM), through PR05. The problem here is in the subform for additional trip information, where the comments entered by the user are getting displayed, is not getting frmatted properly.
    for example.
    2.Had a joint meeting with Mr.ABC, Mr.PQR, Mr.XYZ.
    is getting displayed as
    2.Had a joint meeting with Mr.ABC, Mr.PQR, M       r.XYZ.
    I have not changed any property of the said text area.
    I found a SDN post which says it has been done in the interface. In this case, I am using a standard interface which does not
    have any code in code initialization or Form routine.
    Could you please guide me through.
    Regards,
    Sagar

    Hi Otto,
    First of all thanx for your prompt and kind reply. As I said the text hs been copied from MS Word. There are two boxes in the
    text, wierd characters as you pointed out. But there is a part of text which does not hav those characters, yet there is a space
    infact multiple spaces that appear in the preview.
    I tried typing the part of the text manually in the comments box without the spaces. Then too, some of my words are split into
    two or two words put togather.
    I have also checked changing the font, but that didnt help. And the binding of the text field is set to 'EDITOR'. But if you check
    the context, there is no element called 'EDITOR' not does the form interface have a parameter which passes the long text meant
    for comments . That was the reason I was asking, what are the possible ways we can populate data in a form.
    Regards,
    Sagar

Maybe you are looking for