Hard Light Productions Forums

Off-Topic Discussion => Programming => Topic started by: sayoqod on January 24, 2011, 09:22:22 pm

Title: Need help with Java ASCII
Post by: sayoqod on January 24, 2011, 09:22:22 pm
I have a project that requires me to make a program using ASCII art. I figured out that to use ASCII codes, I just declare the codes in a char variable type.

It works just fine when doing regular letters, but when I try to use special characters like ¶ and €, it only displays question marks in my output.

Is this just a problem with my computer? I thought the whole point of ASCII was that it was universal...

Any help would be appreciated :)

EDIT:

FIXED
Title: Re: Need help with Java ASCII
Post by: Iss Mneur on January 24, 2011, 11:35:46 pm
The standards body that created ASCII only standardized the first 128 characters. These lower 128 are rock-solid and supported just about everywhere, espcially for English speak countries.

The other 128 (also known as the high ASCII characters) are mapped in using code pages (http://en.wikipedia.org/wiki/Code_page).  These code pages are the ones that contain the fancy characters.  Obviously, not every country or corporation or person considers the same 128 characters to be of the same importance (possibly not even the same order).

Depending on how you are outputing the characters (say NetBeans console versus the windows console) will change whether you characters will print correctly or will be converted to unknowns.  The last time I tried to do this, I had the most success with running the app in the windows console window, unfortunately the ones that are in editors are generally very simple.

Hope this helps.
Title: Re: Need help with Java ASCII
Post by: sayoqod on January 25, 2011, 09:38:24 am
Well, I did finally manage to get an email back from my teacher who, along with a few others in the IRC told me to use Unicode. So I did, as per the teacher's instructions, (we're talking copy-paste here.....), and it gave me the same thing. :/ I'm beginning to think it's (somehow) a computer problem....

But thanks :)
Title: Re: Need help with Java ASCII
Post by: Polpolion on January 25, 2011, 12:41:16 pm
Well, I did finally manage to get an email back from my teacher who, along with a few others in the IRC told me to use Unicode. So I did, as per the teacher's instructions, (we're talking copy-paste here.....), and it gave me the same thing. :/ I'm beginning to think it's (somehow) a computer problem....

But thanks :)

have you tried opening the output'd textfile in word or notepad in unicode mode? If it were a computer problem you wouldn't be able to see the paragraph symbol anywhere.
Title: Re: Need help with Java ASCII
Post by: sayoqod on January 25, 2011, 01:10:29 pm
I did, yes. Same problem.

I'm sorry, I should have been more specific about what I'd tried. My mistake. I'll edit the topic now
Title: Re: Need help with Java ASCII
Post by: sayoqod on January 26, 2011, 02:19:47 pm
All right guys, thanks for all the help, but it turns out it really WAS just that my computer doesn't support Unicode :/