How to print a custom character without GUI?

Hello,
I need to print an '@' symbol with an underscore below it.  
I know this can easily be done using a GUI, but I need to send it to the command prompt and a text file if possible.  I thought there might be a way to do this using Unicode characters, but I am unable to figure it out.
LVL 1
JediPimpAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

petmagdyCommented:
write its hexadecimal correspondent from those table:
http://www.i18nguy.com/markup/ncrs.html
0
JediPimpAuthor Commented:
petmagdy,
that page seems to just talk about using the characters with HTML, I need to do it in Java.
0
JediPimpAuthor Commented:
Increased points from 150 to 250.  Anyone know how to do what I need?
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

pjcrooks2000Commented:
Why not store the characters as a string variable

e.g.

String Str = "@";

Then print the string out

System.out.println(Str);

Hope this helps

pjcrooks2000
0
petmagdyCommented:

I tried to get the charater u want i didn't find it on:
http://www.unicode.org
but u can print all unicode characters on a file like this:

      */  
        String str = "";
        char c = '\u0000';
        while(c <=  '\uFEFF' )
        {
            str+=String.valueOf(c) + " ";
               c++;
        }
        System.out.println(str);
//        OutputStreamWriter out = new OutputStreamWriter(new ByteArrayOutputStream());
//        System.out.println(out.getEncoding());
        try
        {
            File fileToWrite = new File( "c:\\characters.txt" );
            FileOutputStream outfile = new FileOutputStream(fileToWrite);
            OutputStreamWriter out = new OutputStreamWriter(outfile, "UTF8");
            System.out.println(out.getEncoding());
            out.write(str);
            out.close();
        }
        catch(Exception ex)
        {
           
        }

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mayank SAssociate Director - Product EngineeringCommented:
>> String Str = "@";
>> System.out.println(Str);

Same as doing System.out.println ( "@" ) ; but it won't print the under-score below it ;-)

Try petmagdy's approach - see if you find that character.
0
pjcrooks2000Commented:
Yes mayankeagle

I realised that after I typed it :)

Just wondering if there is a way to underline text in Java and print this to a console window!  Hmmmm
0
Mayank SAssociate Director - Product EngineeringCommented:
Should be possible if you can find that character in the list.
0
JediPimpAuthor Commented:
I took a look at the unicode web page again and found this in the faq:
http://www.unicode.org/faq/char_combmark.html#12

It talks about how you can combine letters, but it doesn't say how it can be done in java.

The two characters that need to be combined would be U+0040 (the at symbol) and U+005F (the underscore).

I looked through the list, but i didn't see the character that i needed.
0
petmagdyCommented:
ok i am very close:

       char c = '\u0040'; // the @ character
        str+=String.valueOf(c);
        c = '\u0332'; //combining low line character
        str+=String.valueOf(c);
        System.out.println(str);
        try
            {
              File fileToWrite = new File( "f:\\characters.txt" );
              FileOutputStream outfile = new FileOutputStream(fileToWrite);
              OutputStreamWriter out = new OutputStreamWriter(outfile, "UTF16");
            System.out.println(out.getEncoding());
            out.write(str);
            out.close();
            }
        catch(Exception ex)
            {
              
            }

combining means append to ur character one of the combining letters, if LOW line dosn't work for u try one of the other combining letters
0
JediPimpAuthor Commented:
petmagdy,
Are you able to see it as one character, because I am unable to.  The underscore doesn't appear when using the Lucida Sans Unicode font or the Arial Unicode MS font.
0
petmagdyCommented:
yes, open the file generated u will find that it contains only one charater @ with some underline
0
petmagdyCommented:
just try to open the file with notepad
0
JediPimpAuthor Commented:
I did try it with notepad, with each of the four encodings provided, UTF16 doesn't seem to be one of them though.  I also tried viewing it using edit from the dos prompt, that didn't work either.  are you able to copy and paste the char here, or possibly e-mail it, I might be able to just paste it into my program and get it to print.
0
petmagdyCommented:
Here is it, also u can try in my code UTF8 instead of UTF16, it try it gave thr same result

@&#818;
0
petmagdyCommented:
oops the site converted to wha u see!

what is ur OS and what JDK version r u using?
Mine is XP and JDK 1.4.2
0
JediPimpAuthor Commented:
I am using the same. Win XP and JDK 1.4.2.
0
petmagdyCommented:
ok, then u should be able to view the character in file, I can send u the character, please provide means of sending u the file contents
0
JediPimpAuthor Commented:
ok, please send it to dr_nebuchadnezzar03 at yahoo.com
0
petmagdyCommented:
ok done
0
JediPimpAuthor Commented:
I still see the same thing as before, what font are you using in notepad to view it?
0
petmagdyCommented:
Lucida Console
0
JediPimpAuthor Commented:
It still doesn't work, using Lucida Console with any of the encoding formats provided by notepad, so I guess it is probably a problem with my computer.  Thanks for your help.

JediPimp
0
Mayank SAssociate Director - Product EngineeringCommented:
Moderators don't like posting e-mail IDs on question-pages.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Fonts Typography

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.