JDK-4157475 : Character.getNumericValue() returns value other than unicode value
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.1.6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 1998-07-15
  • Updated: 1999-04-28
  • Resolved: 1999-04-28
Related Reports
Duplicate :  
Description

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)
======================================================================