Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Getting Wrong Chars in Request!

  1. #1
    Member
    Join Date
    Mar 2011
    Posts
    84
    My Mood
    Daring
    Thanks
    17
    Thanked 1 Time in 1 Post

    Default Getting Wrong Chars in Request!

    Hi guys

    I recently struck into an Issue, where I'm accepting CSV in a textarea( named=value) within a HTML FORM and method is POST.
    Also I have a LanguageForm (extended from ActionForm) which have a property with value and its setters and getters like

    Framework in use is Struts 1

    public class LanguageForm extends ActionForm {
        private String textValue;
     
        public void setTextValue(String val) {
            System.out.println("LanguageForm:setTextValue:\t"+val);
            textValue = val;
        }
        public String getTextValue() {
            System.out.println("LanguageForm:\t"+textValue);
            return textValue;
        }


    And I provide value in HTML FORM like :

    arvindbis,คงที่,นักพัฒนา -----> THAI Chars(2 of them)

    and submit the form.


    What I got on console :

    Verifying Connection
    Verifying Connection
    Verifying Connection
    Verifying Connection
    Verifying Connection
    Verifying Connection
    LanguageForm:setTextValue: arvindbis,āļ™āļąāļāļžāļąāļ’āļ™āļē,āļ„āļ‡āļ—āļĩāđˆ
    LanguageForm: arvindbis,āļ™āļąāļāļžāļąāļ’āļ™āļē,āļ„āļ‡āļ—āļĩāđˆ
    I'm setting jsp's charset as utf-8

    Where as If I upload a file then I'm getting expected output, but still above one is stored at database.

    I even thought may be db is not accepting these chars so I did manual insertion and DB is working fine. this leads that issue is somewhere in Java Code only
    Tell me what I'm doing wrong?
    Any comment or suggestion is appreciated.


  2. #2
    Junior Member
    Join Date
    Sep 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Getting Wrong Chars in Request!

    your question is very difficult to answer, cause u re not explicit with ur need. what's re u making exactly? 1-do u got a form that u can upload CSV file, 2- what is the contents of ur CSV (arvindbis,คงที่,นักพัฒนา ) 3- after upload u have in the setTextValue (arvindbis,āļ™āļąāļāļžāļąāļ’āļ™āļē,āļ„āļ‡āļ—āļĩāđ ˆ) 4- is right? the step i write?

  3. #3
    Member
    Join Date
    Mar 2011
    Posts
    84
    My Mood
    Daring
    Thanks
    17
    Thanked 1 Time in 1 Post

    Default Re: Getting Wrong Chars in Request!

    Quote Originally Posted by ingscam View Post
    your question is very difficult to answer, cause u re not explicit with ur need. what's re u making exactly? 1-do u got a form that u can upload CSV file, 2- what is the contents of ur CSV (arvindbis,คงที่,นักพัฒนา ) 3- after upload u have in the setTextValue (arvindbis,āļ™āļąāļāļžāļąāļ’āļ™āļē,āļ„āļ‡āļ—āļĩāđ ˆ) 4- is right? the step i write?
    Sorry for giving ambiguous info.

    I'm trying to support all worldly language in my application, i.e. user can see and write in there local language

    But I'm getting issues with certain languages like Arabic, Thai, Japanese etc

    here are the steps:
    1. Html Form is created using html tag struts 1 framework.
    2. My Html form have both facility that EITHER you can upload excel/CSV file( this part is working as expected) OR you can type the contents yourself as I shown in my question already (it is textarea field named as textValue )

    arvindbis,คงที่,นักพัฒนา -----> THAI Chars(2 of them)
    when this OR part is used I get wrong output. ie.
    arvindbis,āļ™āļąāļāļžāļąāļ’āļ™āļē,āļ„āļ‡āļ—āļĩāđ ˆ
    where as uploading file(with contents as "arvindbis,คงที่,นักพัฒนา") shows the following output
    arvindbis,คงที่,นักพัฒนา
    as expected.

    Also these difference is reflected till DB. therefore indirectly leads to corruption of data in DB.

    I hope this time things are well clear, in case not then please let me know.

    --- Update ---

    I was wondering what do we call following characters ?

    āļ™āļąāļāļžāļąāļ’āļ™āļē,āļ„āļ‡āļ—āļĩāđˆ
    which are displayed instead of actual characters

    --- Update ---

    I was wondering what do we call following characters ?

    āļ™āļąāļāļžāļąāļ’āļ™āļē,āļ„āļ‡āļ—āļĩāđˆ
    which are displayed instead of actual characters

  4. #4
    Member
    Join Date
    Mar 2011
    Posts
    84
    My Mood
    Daring
    Thanks
    17
    Thanked 1 Time in 1 Post

    Default Re: Getting Wrong Chars in Request!

    is this an encoding issue??

    if it is then how to verify which encoding is in use??? or in which encoding request is encoded??
    Last edited by arvindbis; October 9th, 2014 at 05:23 AM.

Similar Threads

  1. A For loop that calculates every possible outcome for 2 AND 3 chars...
    By MyNamesMatt in forum What's Wrong With My Code?
    Replies: 5
    Last Post: October 24th, 2012, 10:59 AM
  2. Need help with chars/or's/if statements
    By czarcalvinsk in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 4th, 2012, 08:46 PM
  3. [SOLVED] NullPointerException when using methods to find matching chars in two arrays.
    By Javaisfrustrating in forum Exceptions
    Replies: 4
    Last Post: November 18th, 2011, 04:12 AM
  4. for loop with chars
    By dragon40226 in forum Loops & Control Statements
    Replies: 4
    Last Post: September 25th, 2011, 05:50 PM
  5. Reading input from console (greek chars)
    By lemmyz in forum File I/O & Other I/O Streams
    Replies: 10
    Last Post: August 16th, 2010, 05:37 AM

Tags for this Thread