Unable to print ASCII codes

Hello,
I am facing a problem in printing ASCII code between 128 and 159. these codes are displayed as '?'. All the other codes are printed correctly. Please let me know the reason behind this.
Given below is the code for the same
class Codes
     public static void main(String args[])
          short i = 165;
          for (i=0; i<=256;i+=5)
               System.out.println(i+" "+(byte)i+" "+(i+1)+" "+(byte)(i+1)+" "+(i+2)+" "+(byte)(i+2)+" "+(i+3)+" "+(byte)(i+3)+" "+(i+4)+" "+(byte)(i+4));
Waiting for a quick reply
rgds,
Sameer

1. What are the chars you are talking about? As already mentioned, they are control chars in unicode. What character encoding would you like to use, or in other words, what characters would you like to have for those bytes?
2. The character encoding of the dos console (Cp850 on the windozes I've used) is different from the system's default encoding (Cp1252, IIRC). This will cause problems if you want to print out text having non-ascii characters. For example System.out.println("&Aring;&Auml;&Ouml;") should print out the last three letters of the finnish alphabet but it prints something else instead. But if you write the text to a file it comes out as it should.
Another character encoding can be used by wrapping an OutputStreamWriter around System.out:
OutputStreamWriter osw = new OutputStreamWriter(System.out, "Cp850");
PrintWriter out = new PrintWriter(osw, true);
out.println("&Aring;&Auml;&Ouml;");
Similarly, the input read through the standard inputstream in dos (the keyboard input or redirection using "<") is in another encoding and needs to be converted.

Similar Messages

  • ASCII code to print barcode on Lexmark printer

    Hi there
    Can anyone help me on how to arrive at ASCII code to produce EAN 128B barcode on Lexmark T634n laser printer? 
    TJ

    Hi Elini
    Sorry about the delay in getting back to you.
    I want to print the barcode from SAP Script.
    Please let me know if you need more information.
    Regards & Thanks
    Tripura

  • Unable to print multiple line items in Z-SAP SCRIPT

    Hi ALL,
    We have a scenario where in we are calling the Driver program (RFKORD50) for Document Extract(F.64), Where in we have attached the Z-Script to the program(RFKORD50),
    Unable to print multiple items.
    1) Checked with all the elements in STD program for printing multiple items in main window but unable to get all the items we are able to fetch only 1 item .
    (&BSEG-BUZEI&,,     &BSEG-SGTXT&,,,,&BSEG-DMBTR&)
    2) I have also tried with external subroutine but it also didnot work.it is fetching the latest value.
    Ex: if we have 3 items say 1,2,3 first 2 items are not getting fetched it is taking 3rd item and printing it straight away(Problem is it is not going to script for fetching the first item).
    see the perform which i have used
    /: PERFORM ITEMS IN PROGRAM ZTFI_ZNV20296
    /:USING &BSEG-BUKRS&
    /:USING &BKPF-BELNR&
    /:USING &BSEG-GJAHR&
    /:CHANGING &V_BUZEI&
    /:CHANGING &V_SGTXT&
    /:CHANGING &V_DMBTR&
    /: ENDPERFORM
    IL  &V_BUZEI&,,     &V_SGTXT&,,,,&V_DMBTR&
    Please suggest me whetther we can call write_form from external subroutine. or is there any loop commands in SAP SCRIPT Form.
    Regards,
    Jana

    Hi!
    The LOOP is always within the printer program. In this case also.
    Just check out the RFKORI35 include, the LOOP begins in the 215th line (in 4.6C).
    SORT HBSEG BY BUKRS SORTP1 SORTP2 SORTP3 SORTP4 SORTP5
                          BELNR GJAHR BUZEI.
            LOOP AT HBSEG.
    *         WHERE BUKRS = SAVE_BUKRS.
              SAVE_BUKRS  = HBSEG-BUKRS.
              IF  ( HBSEG-KUNNR = SAVE_KUNNR
              AND   NOT SAVE_KUNNR IS INITIAL )
              OR  ( HBSEG-LIFNR = SAVE_LIFNR
              AND   NOT SAVE_LIFNR IS INITIAL ).
                CLEAR RF140-ELEMENT.
                RF140-ELEMENT = '521'.
                CALL FUNCTION 'WRITE_FORM'
                         EXPORTING  WINDOW    = 'MAIN'
                                    ELEMENT   = '521'
                         EXCEPTIONS WINDOW    = 1
                                    ELEMENT   = 2.
    You might try out to write your code within the 521 elemnt in the sapscript.
    Regards
    Tamás
    Edited by: Tamás Nyisztor on Jun 12, 2008 3:34 PM

  • Unable to print the report after SP2 (CR 2008 / VS 2008)?

    I'm developing an ASP.NET application using VS 2008 (Framework 3.5). I have installed CR 2008 with SP (0, 1, and 2).
    I created an invoice report and I printed it as test for the report and it works okay. I needed to change the page size of the report to a user defined size and reset all of the margins to zero.
    After I did that I was unable to print the report again and every time I tried to print the report nothing gets printed.
    I checked my environment to find the cause of this problem but I found nothing except that I'm using CR runtime for SP1 and I'm currently using SP2. So I did remove CR runtime for SP1 and install CR runtime for SP2.
    The problem didn't go away and I faced one more problem.
    Usually I'm using a dataset as a data source for my reports. After installing the CR runtime for SP2 I couldn't see any date column in my report data source (Dataset). All other types of columns appear except date fields! Why I have no Idea?
    After I do some more testing regarding my issue I found out the following
    1.     When I add a new report to my web application and I don't change the page setting the report work fine.
    2.     When I change the page setup settings (Page Margins, horizontal width and vertical height) the report show up okay but never gets printed.
    Why I don't know?
    Addition to that the report dataset (Data Source) showing in the field explorer never shows any date type field?
    All of the above issues happened with me after installing SP2.
    OS: WindowsXP Pro SP3
    CR 2008 (SP 0, 1, 2)
    VS 2008 SP1
    Please I need your help.
    Edited by: Sami Aljafer on Oct 12, 2009 8:35 PM
    Edited by: Sami Aljafer on Oct 12, 2009 8:38 PM

    Hi, Sami;
    Are you printing from the Crystal preview window, or in code?
    If you are printing from the preview window, try printing via code, such as:
    An example of print to printer:
    crReportDocument = New ReportDocument
    crReportDocument.Load("h:\labels2.rpt")
    ''Use error handling in case an error occurs
    Try
    ''Set the printer name to print the report to. By default the sample
    ''report does not have a defult printer specified. This will tell the
    ''engine to use the specified printer to print the report. Print out
    ''a test page (from Printer properties) to get the correct value.
    crReportDocument.PrintOptions.PrinterName = "
    dwcb12003\ZDesigner ZM400 200 dpi (ZPL)"
    ''Start the printing process. Provide details of the print job
    ''using the arguments.
    crReportDocument.PrintToPrinter(1, True, 1, 1)
    Please post your question about the dataset as a new post.
    Regards,
    Jonathan
    Edited by: Jonathan Parminter on Oct 12, 2009 2:28 PM

  • Unable to print HTML pages

    After a good bit of reading, I found that printing HTML directly to the printer doesn't work for many printers. I don't want to print the code. I want the actual HTML page. I have some code here that reads the HTML file into a JEditorPane and then is rendered into a graphic for printing.
    My code compiles fine, I'm not getting any errors, but what I'm also not getting is any pages printing.
    Here is the source of my class:
    * PrintReport.java
    * @author tristan
    * Created on September 27, 2007, 4:06 PM
    package fedex;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.print.PageFormat;
    import java.awt.print.Printable;
    import java.awt.print.PrinterException;
    import java.awt.print.PrinterJob;
    import java.io.*;
    import javax.print.Doc;
    import javax.print.DocFlavor;
    import javax.print.DocPrintJob;
    import javax.print.PrintException;
    import javax.print.PrintService;
    import javax.print.PrintServiceLookup;
    import javax.print.ServiceUI;
    import javax.print.SimpleDoc;
    import javax.print.attribute.*;
    import javax.print.attribute.standard.*;
    import javax.swing.JEditorPane;
    import javax.swing.RepaintManager;
    public class PrintReport
        private FileInputStream fileIS;
        private Doc doc;
        private DocAttributeSet das = new HashDocAttributeSet ();
        PrintService defaultService;
        /** Creates a new instance of PrintReport */
        public PrintReport ()
        public void printHTMLFile (String file) throws FileNotFoundException, IOException
            PrintableEditorPane jEditorPane = new PrintableEditorPane ();
            jEditorPane.setContentType ("text/html");
            jEditorPane.read (new BufferedInputStream (new FileInputStream (file)), "");
            System.out.println (jEditorPane.getText ());
            PrinterJob job = PrinterJob.getPrinterJob ();
            job.setPrintable (jEditorPane);
            if (job.printDialog ())
                try
                    job.print ();
                catch (Exception ex)
                    System.out.println (ex);
        public class PrintableEditorPane extends JEditorPane implements Printable, Serializable
            public int print (Graphics g, PageFormat pf, int pageIndex) throws PrinterException
                Graphics2D g2 = (Graphics2D)g;
                g2.setColor (Color.black);
                RepaintManager.currentManager (this).setDoubleBufferingEnabled (false);
                Dimension d = this.getSize ();
                double panelWidth = d.width;
                double panelHeight = d.height;
                double pageWidth = pf.getImageableWidth ();
                double pageHeight = pf.getImageableHeight ();
                double scale = pageWidth / panelWidth;
                int totalNumPages = (int)Math.ceil (scale * panelHeight / pageHeight);
                System.out.println ("Total pages to print are " + totalNumPages);
                if (pageIndex >= totalNumPages) return Printable.NO_SUCH_PAGE;
                g2.translate (pf.getImageableX (), pf.getImageableY ());
                g2.translate (0f, -pageIndex * pageHeight);
                g2.scale (scale, scale);
                this.paint (g2);
                return Printable.PAGE_EXISTS;
    }I tried using a complex HTML file as well as a basic one, but everytime Total pages to print are 0 is printed back to the console. I can't figure out why it's unable to create any pages to print.

    DrClap wrote:
    I think you will find thatDimension d = this.getSize ();produces (0, 0) until you actually display your component somewhere. I believe it's possible to "display" it in such a way that it doesn't appear on the user's screen, but I don't know how.
    There's a Swing forum here where you get answers from people who are good at Swing. Posting here attracts answers from people like me who are mediocre at it.I think that calling validate() on a Container will lay it out and size it's components, even if it hasn't been made visible, but don't take my word for it.

  • Unable to print from 11.5.9 on laserjet 2600n on Redhat Linux 4.0 AS

    Dear Experts,
    We recently purchased HP LaserJet Color 2600n. After we bought and installed it in the office network, I was supposed to add this printer in our Redhat Linux 4.0 AS server. While adding this printer, we realized that it is not present in the standard list of printer drivers. And none was available on HP.com for Linux OS!
    After some research, I downloaded and installed driver from the following site - http://foo2hp.rkkda.com/
    The test printout came but in black and white.
    I went and registered this printer in my 11.5.9 apps
    All details same as another working HP Laserjet 4050 printer.
    I cannot print anything from my application!
    I get the following error:
    Printing output file.
    Request ID : 1157149      
    Number of copies : 1      
    Printer : Laserjet2600N
    lp: unable to print file: client-error-not-found
    APP-FND-00500: AFPPRN received a return code of failure from routine FDUPRN. An error occurred while AOL tried to spawn the print process
    Cause: AFPPRN received a return code of failure from the OSD routine FDUPRN. An error occurred while AOL tried to spawn the print process.
    Action: Review your concurrent request log file for more detailed information.
    Finished executing request completion options.
    Kindly help ASAP as the users are waiting for more than a week for this!
    Also, I checked that the name of the printer in the application is same as the one in OS - no problems there.
    Thanks in advance

    Add printer via something like:
    /usr/sbin/lpadmin -p printername -E -v socket://printername -m laserjet.ppd
    Gareth

  • Unable to print BSEG-SGTXT in Main window - SAP Script

    Hi
    I have an issue in Scripts.
    I want to print BSEG-SGTXT in my Main Window and below is my code but i am unable to print the text. while debugging, i am getting value in zsgtxt field, but i am unable to get/print in script.
    can any one help me why it's not printing? and plese suggest where it's wrong.
    In Main window:
    /:   PERFORM TEXT IN PROGRAM ZFIGS_CHECK_PRINTING     
    /:   USING &REGUP-BELNR&                              
    /:   CHANGING &ZSGTXT&                                
    /:   ENDPERFORM                                       
    CH   &ZSGTXT&           
    In Subroutine pool:
    FORM text TABLES intab STRUCTURE itcsy
                             outtab STRUCTURE itcsy.
      DATA: zbelnr(10),
            zsgtxt LIKE bseg-sgtxt.
      READ TABLE intab WITH KEY name = 'REGUP-BELNR' .
      IF sy-subrc = 0.
        MOVE intab-value TO zbelnr.
        SELECT SINGLE sgtxt INTO zsgtxt FROM bseg
              WHERE bukrs = '8140' AND
                    belnr = zbelnr.
        IF sy-subrc = 0.
          MOVE zsgtxt TO outtab-value.
          MODIFY outtab INDEX sy-tabix.
        ENDIF.
      ENDIF.
    ENDFORM.
    Thanks,
    Siva

    Hi,
    Can any one tell how to write loop statement in Main window to display BSEG-SGTXT. As i am getting text (BSEG-SGTXT) from subroutine pool and calling into Main window using Perform statement and printing duplicate text in multiple times insted of different text.
    Thanks,
    Siva

  • ASCII Code in ABAP

    Hi Experts,
    We need to enter a unique ASCII character called 'US' or Unit Separator in a text file being generated through a program.
    The ASCII code for US is 31. However when we try and do it programmatically the character '#' is getting populated.
    The code is as follows:
    DATA : lv_sep type c.
    field-symbols : <xfs> type x.
    assign lv_sep to <xfs> casting.
    <xfs> = 0031.
    write lv_sep.
    Kindly help us out.
    Thanks and Regards,
    Ravi Bhatnagar

    Hi,
    This character is special one, so you can't print it out. In SAP all special charcter which can't be printed are replaced with placeholder #.  They are intended to do theri special purpose in flat file, once you open it.
    Do the following:
    - use fm HR_KR_XSTRING_TO_STRING to convert xstring with value  '1F' (30 decimal value) to string
    - write this string to certain place in internal string table (where you want later use it in the file)
    - download this table as to file
    - special character will do its purpose in text file
    This is the same functionality as you would be placing Line Feed (0x0A - 10 dec). It would be shown as # but once you open downlaoded file you don't see hash # anymore, but you see that new line in that place.
    Hope this is clear
    Regards
    Marcin

  • I am unable to print to the Lightning PDF software (by Avanquest Software) after updating to 6.02. It worked with the previous version of Firefox. Is there a patch or fix for this problem?

    I am unable to print to the Lightning PDF software (by Avanquest Software) after updating to 6.02. It worked with the previous version of Firefox. Is there a patch or fix for this problem?
    This is the error that is received:
    Cannot open file "C:\Users\Calandra\AppData\Local\Temp\Ask_a_Question__Firefox_Help.pdf". The process cannot access the file because it is being used by another process
    Any information that you can provide will be greatly appreciated.

    Sorry to say that, but the entire system seems ill-designed.
    If I understand correctly, then to add a new Section to a site, you have to subclass SubSection and somewhow integrate that into the system?
    I would be my expectation that you only need to subclass SubSection when you tried to introduce a new type of SubSection.
    The title & all other natural language Strings should never be hardcoded in Java code, but rather taken from some external storage (Database, XML, flat files, ...).

  • After installing update 11.0.07, I have been unable to print pdf douments from websites displayed in I.E. 11

    I just installed 11.0.07 and since then have been unable to print pdf documents from websites displayed in I.E. 11 (32 bit). The problem did not exist until I installed the update. Opening the same sites with Chrome solves the problem, but some of the important sites I use, (FAA WebOPPS for instance) don't work with Chrome or anything other than I.E. for that matter. Does anyone know if Adobe is aware of the bug and working on a fix?

    Let me put it in context.I am a developer, and in my work we create a flex application a few years ago and we are providing support to this application. Since 2 days ago th button we create in our application for View PDF just stopped working. We use this code:
    public function navigate( url:String ):void
      navigateToURL( new URLRequest( url ), OPEN_NEW_WINDOW );
    It is very simplistic and worked fine as I told you, until Tuesday this week. Please tell me what happened, it seems the last plugin version crashes somewhere and my button just does not work any more.
    Thank you.

  • Caesar Cipher and non printing ascii

    I am writing a program to implements the caesar cipher. For the program I am using ASCII code so my encryption algorithm is:
    c = (p + k) mod 128
    The only problem is, is that depending on the characters being encrypted and depending on the key I use some of the characters are encrypted to non-printing ascii characters such as 'del'.
    So my code reads in the plain text from a file converts each character to ascii, encrypts each character using the key. It then writes the encrypted ascii values to a file as text (i.e. the character equivalent of the ascii).
    If I do then encounter a non-printing ascii value it is written to the file as a square shape. Is there any way I can get around this?
    Thanks for your help on the matter.
    Wallace

    Modify your encryption function so that it only covers those ASCII values that print, i.e. you need to implement the mod and + function yourself so that only good ASCII characters are considered.

  • Extended Ascii Code in Swing

    Hi master,
    I have found some viewing extended ascii code in Swing. The palteform I used is Windows Me.
    It is not viewing properly for some of chars with ascii code more than 127 to 255.
    Any idea would be appreciate.
    Thanks in advance!

    Hi,
    This character is special one, so you can't print it out. In SAP all special charcter which can't be printed are replaced with placeholder #.  They are intended to do theri special purpose in flat file, once you open it.
    Do the following:
    - use fm HR_KR_XSTRING_TO_STRING to convert xstring with value  '1F' (30 decimal value) to string
    - write this string to certain place in internal string table (where you want later use it in the file)
    - download this table as to file
    - special character will do its purpose in text file
    This is the same functionality as you would be placing Line Feed (0x0A - 10 dec). It would be shown as # but once you open downlaoded file you don't see hash # anymore, but you see that new line in that place.
    Hope this is clear
    Regards
    Marcin

  • Help me print ASCII table to screen

    I want to output all characters from 0 to 255 to screen, but some characters display invalid (it return character "?" ). Can you help me ? What's charSet I have to use ???
    Thank you very much.
    LMHUNG

    Some of the ASCII codes are for 'non-printable' characters
    e.g. carriage-return, line feed, etc.
    So you won't be able to print those ones.

  • Printer control codes

    Anyone know where to get printer control codes for an HP Laserjet printer?  Back in the old days of dot matrix printers,  the manuals always had tables for ASCII, HEX or IBM, etc control codes.  I have some old "Basic" software that I want to imbed printer commands to do things like expanded print, bold print, etc.

    A table of simple PCL commands is available here.
    Regards,
    Bob Headrick, Microsoft MVP Printing/Imaging
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • Need help with converting characters to ASCII code

    Hey. Im trying to write a program to make Caesar Ciphers by random numbers. This cipher must also wrap from front to end of ASCII code, so that if, for example, the character being ciphered is Z and its being modified by +3, the result ciphered character is not "]", but "c".
    Im planning on reading the text that the user inputs (using ConsoleIO) into a string and then seperating each character into a character[]. Then, i would like to find the ASCII code of each character and print out the ASCII code character of the old ASCII code + the modifier.
    So far, this is what i have (sorry for the length, i like to space things out so that its easier on the eyes and more organized... X-( ... ):
    public class EvanFinalB {
         static ConsoleIO kbd = new ConsoleIO();
         static String enteredPhrase;
         static int phraseLength;
         public static void main(String[] args)
              System.out.println("Enter a phrase and this program will cipher it into a secret message.");
              System.out.println("/nEnter your phrase here:");
              //read phrase
              enteredPhrase = kbd.toString();
              //find length of entered text
              phraseLength = enteredPhrase.length();
              //declare arrays for the individual characters of the entered text and the ciphered characters
              char[] enteredChar = new char[phraseLength + 1];
              char[] cipheredChar = new char[phraseLength + 1];
              //loop converting of entered text into seperate characters
              for(int x = 1; x <= phraseLength; x++)
                   enteredChar[x] = enteredPhrase.charAt(x);
                   cipheredChar[x] = cipher(enteredChar[x]);//call cipher() method to find new ciphered character
         //wrap from front to end of ASCII code
         static char cipher(char enteredChar)
              //choose random number to cipher message by
              int modifier = (int)(Math.random() * 26) + 1;
              if(enteredChar + modifier > 90)//90 is the ASCII code for "Z" which is the last capital letter
                   cipheredChar = (97 + (modifier - (90 - enteredChar)));//97 is the ASCII code for "a" which is the first lower case letter
              return cipheredChar[1];
    }The program is obviously in its early stages but (i started creating it today actually), if there is a simple method or anything that i can use to find the ASCII value of a character in order to use enteredChar so that 'enteredChar' is equal to the ASCII code of the new ciphered character, please help me out...Thanks
    P.S. If there's an easier way to go about creating a program for Caesar Ciphers, let me know.

    The following code is from my Java textbook Big Java by Cay Horstmann. It is not my code and it's just to guide you in your own cipher.
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.io.IOException;
       This class encrypts files using the Caesar cipher.
       For decryption, use an encryptor whose key is the
       negative of the encryption key.
    public class CaesarCipher
          Constructs a cipher object with a given key.
          @param aKey the encryption key
       public CaesarCipher(int aKey)
          key = aKey;
          Encrypts the contents of a stream.
          @param in the input stream
          @param out the output stream
       public void encryptStream(InputStream in, OutputStream out)
             throws IOException
          boolean done = false;
          while (!done)
             int next = in.read();
             if (next == -1) done = true;
             else
                byte b = (byte) next;
                byte c = encrypt(b);
                out.write(c);
          Encrypts a byte.
          @param b the byte to encrypt
          @return the encrypted byte
       public byte encrypt(byte b)
          return (byte) (b + key);
       private int key;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.util.Scanner;
       This program encrypts a file, using the Caesar cipher.
    public class CaesarEncryptor
       public static void main(String[] args)
          Scanner in = new Scanner(System.in);
          try
             System.out.print("Input file: ");
             String inFile = in.next();
             System.out.print("Output file: ");
             String outFile = in.next();
             System.out.print("Encryption key: ");
             int key = in.nextInt();
             InputStream inStream = new FileInputStream(inFile);
             OutputStream outStream = new FileOutputStream(outFile);
             CaesarCipher cipher = new CaesarCipher(key);
             cipher.encryptStream(inStream, outStream);
             inStream.close();
             outStream.close();
          catch (IOException exception)
             System.out.println("Error processing file: " + exception);
    }

Maybe you are looking for

  • Cannot open link with PDF in windows7

    I got a new computer with windows 7( 64 bits) and I have got the latest version for Acrobat reader (Windows 7/English 10.1.3). When I search for a web page and I get links that contain PDF documents, I cannot open the PDF docs.  The Adobe reader trie

  • 5G iPod skipping songs after iPod Update 1.1

    After I updated my 5G 60 Gig video iPod to Update 1.1, my iPod started to skip certain songs. I have tried erasing the songs, importing them again from the CD, and reloading them back to the iPod and the iPod still won't play those SPECIFIC songs! Ne

  • Monitor settings incorrect and can't get to system prefs to change them

    Hi, I was experimenting with screen resolution settings and somehow came up with one that doesn't allow me to get to any finder controls or to the apple icon. So I can't use my computer. Help!

  • Access List and Conflict Resolution Problem!

    My configuration for Allow and Deny is not allowing me to load images and CSS files through the gateway on a URLScraper channel. I'm trying to figure out how to control access to resources using the Access List service, and I'm running into trouble.

  • Problem with Explorer

    Hello everyone, The internet explorer is shutting down all the time , is any one know this problem ? the notebook is  N100 thanks Erik