Converting an english character to ASCII without files

I am working on an encryption project for school and can't find any code that will convert a single character to the ascii counterpart. There is the:
String p = System.getProperty("line.separator");
System.out.println(p);
But that only converts to the primary code of the computer used. There is also code that will convert like this, but writes to a file. I only need it to output the counterpart in ascii within the program, not a file. I know this is probably simple but I cannot find how to do so. I could build a class that will do it, but I am sure it's already out there. I just need to know the syntax. It could work like this:
convert(R); //will produce ASCII code for character 'R'
outputs: 82
If anyone can help email me or post a reply. Thanks for your time.

ok, someone correct me if I'm wrong, but - isn't there a direct map between the int value of the char and the char value of the int? That is, when I run this program...
public class CharConvert {
    public static void main(String[] args) {
        char charToConvert = '\uFEFC';
        int codeToConvert = 65276;
        System.out.println("Char converts to: " + (int)charToConvert);
        System.out.println("Code converts to: " + (char)codeToConvert);
}I get the output
$ java CharConvert
Char converts to: 65276
Code converts to: ?('cause my shell can't seem to spit out that arabic symbol tha tis unicode FEFC). So, can't we just cast to convert here? Or am I missing something?
What I'm saying is, can't RadiantProgrammer just say
char rChar = (char)rCode;?
Lee

Similar Messages

  • Spool non english character names to a file

    Hi There,
    We have a table which has around a million rows. We just need to select two columns(out of which one is a name field with english and non english names) and spool the data to a file. The problem is that through sqldeveloper, if I choose csv or dsv option, the non english names, like chines charaters etc show up as question marks. Is there a better way or format to do this. I tries xls. But although it goes through successfully, when I open the excel file, it has nothing. I was able to do it for around 200000 rows in excel.
    Any suggesstions?
    Thanks,
    Sun
    Edited by: ryansun on Jun 23, 2012 4:24 AM

    ryansun wrote:
    Hi There,
    We have a table which has around a million rows. We just need to select two columns(out of which one is a name field with english and non english names) and spool the data to a file. The problem is that through sqldeveloper, if I choose csv or dsv option, the non english names, like chines charaters etc show up as question marks. Is there a better way or format to do this. I tries xls. But although it goes through successfully, when I open the excel file, it has nothing. I was able to do it for around 200000 rows in excel.
    Any suggesstions?
    Thanks,
    Sun
    Edited by: ryansun on Jun 23, 2012 4:24 AMwhen dealing with non-ASCII characters, two different issues can exist,
    1) data storage - incorrect byte value is stored
    2) data presentation - incorrect character is displayed.
    Can the utility utilized to view the *CSV file actually display the non-ASCII value properly?
    can you inspect the *CSV file using an hexadecimal editor? what do you see inside the file?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Error when import file with non-english character

    Hi,<br /><br />I have images file with non-english character (unicode), for example ABC<X>.png where <X> is non-english character such as japanese, chinese, etc.<br /><br />Whenever I want to import the file to After Effects (right click -> import -> file), I always encounter error:<br /><br />Finding file/dir info for the file "C:\...\ABC?.png" -- file not found (-43) (3::30)<br />Can't import file "ABC?.png": unsupported filetype or extension. (0::1)<br /><br />My PC is Windows XP Professional 2002 SP2 English.<br /><br />How to solve this problem?<br /><br />Thanks

    Adjust your system language settings. Proper file name conventions require a consistent Unicode environment, so install the respective foreign language support files or switch the language system-wide. Mixing different zones/ code ranges is always a bad idea. If your system is not in Japanese, AE will always misinterpret the characters and refuse to import. If that's not feasible, simply rename the files.
    Mylenium

  • How to convert character to ascii

    Hi i need to check the value of the character less than space so need to make calc based on ASCII values
    can some one tell me how can i convert chars & numbers to ASCII

    Hi,
    Please check this code:
    Below logic is for convert from character to ascii value :
    report test.
    *going from A to 65
    data : c value 'A'.
    field-symbols : <n> type x.
    data : rn type i.
    assign c to <n> casting.
    move <n> to rn.
    write rn.
    Below logic is for convert from ascii tocharacter value :
    *going from 66 to B
    data : i type i value 66.
    data : x type x.
    field-symbols : <fc> type c.
    move i to x.
    assign x to <fc> casting type c.
    move <fc> to c.
    write c.
    May it gives you some idea.
    I hope it helps you.
    Thanks.
    Deepak Sharma.

  • Csv upload -- suggestion needed with non-English character in csv file

    <p>Hi All,</p>
    I have a process which uploads a csv file into a table. It works with the normal english characters. In case of non-English characters in the csv file it doesn't populate the actual columns.
    My csv file content is
    <p></p>First Name | Middle Name | Last Name
    <p><span style="background-color: #FF0000">José</span> | # | Reema</p>
    <p>Sam | # | Peter</p>
    <p>Out put is coming like : (the last name is coming as blank )</p>
    First Name | Middle Name | Last Name
    <p><span style="background-color: #FF0000">Jos鬣</span> | Reema | <span style="background-color: #FF0000"> blank </span></p>
    <p>Sam | # | Peter</p>
    http://apex.oracle.com/pls/otn/f?p=53121:1
    workspace- gil_dev
    user- apex
    password- apex12
    Thanks for your help.
    Manish

    Manish,
    PROCEDURE csv_to_array (
          -- Utility to take a CSV string, parse it into a PL/SQL table
          -- Note that it takes care of some elements optionally enclosed
          -- by double-quotes.
          p_csv_string   IN       VARCHAR2,
          p_array        OUT      wwv_flow_global.vc_arr2,
          p_separator    IN       VARCHAR2 := ';'
       IS
          l_start_separator   PLS_INTEGER    := 0;
          l_stop_separator    PLS_INTEGER    := 0;
          l_length            PLS_INTEGER    := 0;
          l_idx               BINARY_INTEGER := 0;
          l_quote_enclosed    BOOLEAN        := FALSE;
          l_offset            PLS_INTEGER    := 1;
       BEGIN
          l_length := NVL (LENGTH (p_csv_string), 0);
          IF (l_length <= 0)
          THEN
             RETURN;
          END IF;
          LOOP
             l_idx := l_idx + 1;
             l_quote_enclosed := FALSE;
             IF SUBSTR (p_csv_string, l_start_separator + 1, 1) = '"'
             THEN
                l_quote_enclosed := TRUE;
                l_offset := 2;
                l_stop_separator :=
                       INSTR (p_csv_string, '"', l_start_separator + l_offset, 1);
             ELSE
                l_offset := 1;
                l_stop_separator :=
                   INSTR (p_csv_string,
                          p_separator,
                          l_start_separator + l_offset,
                          1
             END IF;
             IF l_stop_separator = 0
             THEN
                l_stop_separator := l_length + 1;
             END IF;
             p_array (l_idx) :=
                (SUBSTR (p_csv_string,
                         l_start_separator + l_offset,
                         (l_stop_separator - l_start_separator - l_offset
             EXIT WHEN l_stop_separator >= l_length;
             IF l_quote_enclosed
             THEN
                l_stop_separator := l_stop_separator + 1;
             END IF;
             l_start_separator := l_stop_separator;
          END LOOP;
       END csv_to_array;and
    PROCEDURE get_records (p_clob IN CLOB, p_records OUT varchar2_t)
       IS
          l_record_separator   VARCHAR2 (2) := CHR (13) || CHR (10);
          l_last               INTEGER;
          l_current            INTEGER;
       BEGIN
          -- SIf HTMLDB has generated the file,
          -- it will be a Unix text file. If user has manually created the file, it
          -- will have DOS newlines.
          -- If the file has a DOS newline (cr+lf), use that
          -- If the file does not have a DOS newline, use a Unix newline (lf)
          IF (NVL (DBMS_LOB.INSTR (p_clob, l_record_separator, 1, 1), 0) = 0)
          THEN
             l_record_separator := CHR (10);
          END IF;
          l_last := 1;
          LOOP
             l_current := DBMS_LOB.INSTR (p_clob, l_record_separator, l_last, 1);
             EXIT WHEN (NVL (l_current, 0) = 0);
             p_records (p_records.COUNT + 1) :=
                REPLACE (DBMS_LOB.SUBSTR (p_clob, l_current - l_last, l_last),
             l_last := l_current + LENGTH (l_record_separator);
          END LOOP;
       END get_records;Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Getting a request in a non English character

    Hi ,
    In an attempt to solve a problem of getting a request in a non English character , i use the code , taken from O'Reilly's "Java Servlet programing" First edition:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class MyServlet extends HttpServlet {
         public void doGet(HttpServletRequest req, HttpServletResponse res)
                                                                               throws ServletException, IOException {
              try {
                                                      //set encoding of request and responce
         req.setCharacterEncoding("Cp1255"); //for hebrew windows
         res.setCharacterEncoding("Cp1255");
         res.setContentType("Text/html; Cp1255");
         String value = req.getParameter("param");
                                                      // Now convert it from an array of bytes to an array of characters.
         // Here we bother to read only the first line.
                                                      BufferedReader reader = new BufferedReader(
         new InputStreamReader(new StringBufferInputStream(value), "Cp1255"));
                                                      String valueInUnicode = reader.readLine();
              }catch (Exception e) {
              e.printStackTrace();
    this works fine , the only problem is that StringBufferInputStream is deprecated .
    is there any other alternative for that ?
    Thanks in advance
    Yair

    Hi Again ..
    To get to the root of things , here is a servlet test and an http client test which demonstrates using the above patch and not using it :
    The servlet :
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.PrintWriter;
    import java.io.StringBufferInputStream;
    public class Hebrew2test extends HttpServlet {
         public void doGet(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException {
              request.setCharacterEncoding("Cp1255");
              response.setCharacterEncoding("Cp1255");
              response.setContentType("Text/html; Cp1255");
              PrintWriter out = response.getWriter();
              String name = request.getParameter("name");
              //print without any patch
              out.println(name);
              //a try with patch 1 DEPRECATED
              out.println("patch 1:");
              BufferedReader reader =
              new BufferedReader(new InputStreamReader(new StringBufferInputStream(name), "cp1255"));
              String patch_name = reader.readLine();
              out.println(patch_name);
              //a try with patch 2 which doesn't work          
              out.println("patch 2:");
              String valueInUnicode = new String(name.getBytes("Cp1255"), "UTF8");
              out.println(valueInUnicode);
    and now for a test client :
    import java.io.*;
    import java.net.*;
    public class HttpClient_cp1255 {
    private static void printUsage() {
    System.out.println("usage: java HttpClient host port");
    public static void main(String[] args) {
    if (args.length < 2) {
    printUsage();
    return;
    // Host is the first parameter, port is the second
    String host = args[0];
    int port;
    try {
    port = Integer.parseInt(args[1]);
    catch (NumberFormatException e) {
    printUsage();
    return;
    try {
    // Open a socket to the server
    Socket s = new Socket(host, port);
    // Start a thread to send reuest to the server
    new Request_(s).start();
    // Now print everything we receive from the socket
    BufferedReader in = new BufferedReader(new InputStreamReader(s.getInputStream(),"cp1255"));
    String line;
    File f = new File("in.txt");
    FileWriter out = new FileWriter(f);
    while ((line = in.readLine()) != null) {
    System.out.println(line);
    out.write(line);
    out.close();
         catch (Exception e) {
    e.printStackTrace();
    class Request_ extends Thread {
    Socket s;
    public Request_( Socket s) {
    this.s = s;
    setPriority(MIN_PRIORITY); // socket reads should have a higher priority
    // Wish I could use a select() !
    setDaemon(true); // let the app die even when this thread is running
    public void run() {
    try {
                        OutputStreamWriter server = new OutputStreamWriter(s.getOutputStream(),"cp1255");
                        //String query= "GET /userprofiles/hebrew2test?name=yair"; //yair in Englisg ..
                        String query= "GET /userprofiles/hebrew2test?name=\u05d9\u05d0\u05d9\u05e8"; //yair in hebrew - in unicode
                   System.out.println("Connected... your HTTP request is sent");
                        System.out.println("------------------------------------------");
                        server.write(query);
                        server.write("\r\n"); // HTTP lines end with \r\n
                        server.flush();
                        System.out.println(server.getEncoding());
         server =      new OutputStreamWriter(new FileOutputStream("out.txt"),"cp1255");
                        server.write(query);
                        server.flush();
    catch (Exception e) {
    e.printStackTrace();

  • Chinese character overlap in PDF file

    Hi guyz,
    I am working on the issue on Chinese character overlap in PDF file.
    There is smartform which is being used to generate ePaySlip(Comes in email) in PDF file format which contains Chinese and English both characters.
    Now the issue is that at the bottom of the ePaySlip there is a Remark section which is maintained in Chinese and English both. However, the English sentences are proper withour any problem whereas the same thing in Chinese is showing as distorted/overlapped in few words.
    Can anyone suggest what could be the cause and suggest some solution.
    As when I checked in smartform those characters are hard coded and Chinese characters are shown as ###.
    Please response, I would be really grateful.
    Thanks & Regards,
    Mini

    Hi,
    there a different things to know.
    I produce sapscript forms with cinese and english characters for frontend / backend and archiv printing.
    Please check:
    Editor displays ###: You have to install the chinese language in your e.g. windows-system to display them.
    Script: You have to chose the the font family "CNSONG" (customized for chinese simplified and LATIN).
    Transaction I18N: May you have to set correct subfonts for the unicode areas (Cascading fonts, Standard is Courier).
    You can print in different ways:
    For archiv/PDF: Install the unicode truetype font with chinese characters for the pdf-converter.
    For Frontend: Use the Frontendprinter SAPWIN or SAPWIN*CF (Cascading Font) to send it to the gui (note: SAPLPD does not support it, use the newer technology.....)
    Backend printing: POSTSCRIPT is not yet implemented :-((
    PLease note: What you see in spool / print preview is a simulation of the possible print, but backend print is not frontend preview!!!!
    Regards,
    Christian

  • Does querybuilder support non-english character?

    I want to make query using querybuilder with non-english character (Chinese)?
    I tried with http://localhost:4502/libs/cq/search/content/querydebug.html but it is not working.
    below is my query string:
    property=contenttext
    property.value=&#20320;&#22909;&#21966;
    I have converted the chinese character (你好嗎)to unicode.
    Can anyone help me?

    That's a bug in the debugger UI. But it's easy to fix:
    in crxde lite, overlay /libs/cq/search/components/querydebug/querydebug.jsp by copying it to /apps/cq/search/components/querydebug/querydebug.jsp
    open /apps/cq/search/components/querydebug/querydebug.jsp
    find the line "props.load(new ByteArrayInputStream(queryParam.getBytes("ISO-8859-1")));"
    and replace with "props.load(new StringReader(queryParam));"
    Will be fixed in 5.6.1.

  • Problem with SQL Convert Function Junk Character

    Hi All,
    We have a database field that has a value of “2.020 OPERATOE’S CAB – GLASSES” on the front end of Oracle E-Business Suite. When we are spooling that column(in PLSQL) with the SQL covert function , one of the characters(’) in the string is not getting converted properly. It is displayed as a junk character in the spooled file.
    We used CONVERT(p_column,'WE8ISO8859P1','UTF8') for converting the string and utl_file api for spooling the output file. Please note that converted string is passed to utl_file.fopen directly.
    Following are the nls_parameters values.
    NLS_CHARACTERSET ~~ UTF8
    NLS_NCHAR_CHARACTERSET ~~ AL16UTF16
    Any inputs are welcome.
    Thanks
    gt1942

    Hello All,
    Sorry, If I am opening the blog in the wrong place as this is the first time.
    my out looks as follows.
    "02920  "
    but when i see in the application there is nuthing in the end.
    so I used regexp_replace(p_vendor_dtl,'[^[!-~]]*',''), But this is removing spaces also. I don't want to remove space. I want to remove this character only.
    Please help
    Thanks.

  • Chinese character in PDF output file ?

    I have trouble to display Chinese characters (traditional Chinese) on PDF output file. Is there anyone can help ?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Rene Kello ([email protected]):
    From 'Reports 6i Release Notes'...
    Reports supports PDF 1.1.
    The Adobe Acrobat Reader cannot read .PDF report files generated by Report Builder if the report contains certain types of non- English character set languages (typically multi-byte) or Unicode character set.
    Same with reports 6.
    Install Acrobat Reader 4.X. Print to Acrobat Distiller printer. Works for Baltics.
    cheers,
    Rene.<HR></BLOCKQUOTE>
    It works ! Thank you !

  • Character Mode ASCII Distribution

    Hi,
    I have a distribution report, Character Mode, ASCII format, that I can run without any problems from Report Builder, but the output is wrapping after what appears to be 80 characters, how do I make this wider? I've set my Main Section -> Character Mode -> Report Width to 190 without any change.
    Thanks,
    Lena Lafond

    In the Layout Model, Header Section or Main Section or Trailer Section's properties according to which section you are referring to.
    I think this is new with Reports 6i.

  • How to convert Oracle reports previewer output into delimited file.

    How to convert Oracle reports previewer output into delimited file if the report has more than 1000 pages.
    I tried with previewer option File --> Generate to file --> Delimited file, but the report engine is crashing.Not generating .TXT file.
    I observed that this option is not working for more than 400 pages.
    I am using Oracle reports 6i version.
    Plz suggest me to generate .TXT file from Report previewer.

    You can specify a delimiter (a character or string of characters) to separate the data (boilerplate or field objects) in your report output in either of the following ways:
    On the command line using the DELIMITER keyword.
    In the Delimited Output dialog box or DelimitedData Output dialog box (displayed with File > Generate to File > Delimited or File > Generate to File > DelimitedData) in Reports Builder.
    for further information goto this link
    http://download.oracle.com/docs/cd/B14099_17/bi.1012/b13895/orbr_concepts2.htm#sthref760

  • DNG converter don't work for some RW2-files

    Hi,
    i found out, that there ist now direct support from CS4 to my new Lumix LX5. :-(
    In  some forums i got the hint to use the free DNG converter. that works  for most of the files, but some rw2's it can't convert. yesterday i made  10 pictures and the converter only identificate 7 of them. The only  thing i noticeed ist, that this files are "only" 7MB. The others are  10MB. When i use irfanview to look the rw2's are no problems. the  pictures are all very good. somebody an idea whats wrong with the 3?
    Thanks
    pittip
    sorry for my english, but i hope you understand me!??

    I don't know anything at all about your file format, but it sounds as if there is an option to create compressed raw files.  I know Canon has this option.  It may be that somehow you used this compressed option, assuming that there is one, and it may be that the DNG converter does not support the compressed raw format.  If not, maybe someone else will have a better answer.

  • MP-00038: Could not convert to environment character set's handle

    I wan't import an Oracle 10g database dump into Oracle Express:
    source DB runs on Linux
    NLS_LANG=AMERICAN_AMERICA.WE8DEC
    destination
    Windows:
    NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252
    X:\>imp system/manager file=edb.dmp full=y
    Import: Release 10.2.0.1.0 - Production on Wed Nov 14 09:25:40 2007
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Productio
    n
    IMP-00038: Could not convert to environment character set's handle
    IMP-00000: Import terminated unsuccessfully
    What can I do ???

    Hi sivaram,
    how exactly did you export from 11g, and how did you try to import? (Commands with parameters would be great, probably also the first lines of each log file)
    And which exact database release did you export from? Which character set does it use?
    -Udo

  • LSMW: Convertion of special character turn into #

    Hi all,
    Ich am Ulpoading a file in the step 'READ DATA' in LSMW and when I check the result in the next step 'DISPLAY READ DATA' I see that the upload (i do not know if LSMW make an WS_UPLAOD or GUI_UPLOAD or another function) converts a special character that we use in Portugal
    in the file:           Fabricação
    in LSMW after Upload:  Fabrica##o
    The file was an Excel which I saved as txt (tab delimited)
    Who can help??????
    Thanks
    Picasso

    Hi Picasso,
    LSMW is having 'GUI_UPLOAD' function module to upload data.
    GUI_UPLOAD FM is having import parameter CODEPAGE.Whose functinality is to take care of such special character.
    Include which is called for READ DATA step, you can very wel find out that the codepage is not suitable for your Portuguese language.
    Do one thing write an BDC...Call GUI_UPLOAD FM and then Pass CODEPAGE number.
    codepage number you will get from  tcp00 table.
    here is example to take care of special Japanese character:
    CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = l_ws_path
          filetype                = 'ASC'
          has_field_separator     = '#'
          codepage                = '6300'
        TABLES
          data_tab                = i_aenr
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.

Maybe you are looking for

  • How to calculate a date in the future and set it as field value?

    I'm trying to set the value of a read-only field to a date and time 72 hours from the current date and time. Here's how I'm doing it now: var futureInMilliseconds = new Date().getTime() + 259200000; // current date and time + 72 hours in milliseconds

  • PDF opens in Reader but Reader is not my default viewer

    I have doPDF as one of my printers so I can create a PDF file. In Control Panel Folder Options, my default PDF viewer is set to Foxit. That is what I want. I have Acrobate Reader on my PC for the rare instances I NEED Acrobate Reader. When I select d

  • ITunes and iPad

    I have some money left from a gift card in my iTunes store account on my PC. When I log into my account on the iPad the money does not show up and it charges my credit card for any app purchases. Is there a way to get my balance from the gift card to

  • Where to find the css file for logon page customization

    Hi All, I am doing the logon page customization but i am not finding the stylesheet to change the background colors. While testing it is taking the default css stylesheet. Can anyone suggest from where to edit the css file? With Regards Ashutosh

  • Collection.addAll?

    I have an arbitary object an override the equals() method on the object. eg. public class Thing { public boolean equals() { I have a Vector of these Thing objects. Now the problem I get is when I create a HashSet and add the Vector using addAll(Colle