Results 1 to 4 of 4
  1. #1
    patriotsfan is offline Member
    Join Date
    May 2011
    Posts
    38
    Rep Power
    0

    Default Issues with weird characters

    I am having weird characters that show up in my java program such as " ". I am using inputStream and reading from a .txt file. Also, what is weird is that when I run in netbeans preview mode or as an executable .jar I get different results. When running in netbeans preview I get two squares and as a .jar I get " ". Is this something possibly with encoding settings? I have no knowledge about this, if someone could help out I would appreciate it.

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default Re: Issues with weird characters

    The file is written in one character encoding and the system is reading in a different character encoding.

  3. #3
    patriotsfan is offline Member
    Join Date
    May 2011
    Posts
    38
    Rep Power
    0

    Default Re: Issues with weird characters

    I care about how the jar shows the text file so is there anyway for me to manually change the settings output on jar?

  4. #4
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: Issues with weird characters

    Wrap your InputStream in an InputStreamReader and specify the charset in the InputStreamReader's constructor. Then it will always use the same charset regardless of the system default.
    Get in the habit of using standard Java naming conventions!

Similar Threads

  1. Weird NullPointerException
    By Hollowsoul in forum JCreator
    Replies: 2
    Last Post: 07-13-2011, 11:46 PM
  2. Weird NullPointerException
    By Boreeas in forum New To Java
    Replies: 7
    Last Post: 07-12-2011, 12:30 PM
  3. Weird output
    By gandalf5166 in forum New To Java
    Replies: 2
    Last Post: 02-28-2010, 10:17 PM
  4. weird problem
    By GPB in forum New To Java
    Replies: 2
    Last Post: 02-28-2010, 01:04 PM
  5. Weird Error?
    By sciguy77 in forum New To Java
    Replies: 4
    Last Post: 01-20-2009, 03:32 AM

Posting Permissions

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