Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4157475

Character.getNumericValue() returns value other than unicode value

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.1.6
    • core-libs
    • x86
    • windows_nt



      Name: tb29552 Date: 07/15/98


      /* When I use the Character.getNumericValue method it
       * does not return the unicode value. Here is some
       * source code that demonstrates the problem.
       *
       * This demo code returns -1 for all punctuation,
       * indicating that there is no value for spaces or any
       * type of punctuation. Yet last time I checked these
       * characters had unicode values.
       */

      import java.io.*;

      public class CharacterTest{

        public static void main(String arg[]){
          String string=null;

          //DataInputStream in=new DataInputStream(System.in);
          BufferedReader in = new BufferedReader
            (new InputStreamReader(System.in));

          while(true){
            System.out.print("input>");
            try{string=in.readLine();} catch(IOException e){}
            System.out.println("\n"+Character.getNumericValue(string.charAt(0)));
          }
        }
      }

      (Review ID: 34561)
      ======================================================================

            mmcclosksunw Michael Mccloskey (Inactive)
            tbell Tim Bell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: