SetString() and Unicode to ASCII/ISO conversion

Hi,
I encountered next problem. My database works in ISO-Latin-1 character set. Still, if I call PreparedStatement.setString(String arg) I would expect this call would convert arg parameter to ISO-Latin-1 using standard conversion mechanism. But after some testing I found out that instead of converting Java characters Oracle's driver just skips hi-byte. So if I have character with hex code 0x2019, which is absolutely normal unicode character. Oracle's driver converts it into 0x19 code, which is not even printable character and not valid ASCII code. Java's standard CharToByteConverter gives 0x63 ('?') code, which, at least, is valid ASCII/ISO-1 character.
And some soft reports "Invalid Character" errors encountering 0x19 and other such codes.
Here's a fragement from Oracle's JDBC log:
DBCV DBG2 UCS-2 bytes (10 bytes):
20 19 20 1c
DBCV FUNC DBConversion.stringToAsciiBytes(str)
DBCV DBG2 DBAccess bytes (5 bytes):
19 1c
Has anyone encountered this problem? Has anyone found work-around?
Checking and converting all strings before calls to setString() would be too overwhelming.
Thanks,
Dmitry

You may not store a string as ASCII values.
Any string you create is stored in Unicode.
The first 128 elements of Unicode are the same as ASCII.
If you want the ASCII representation of the letter "a", then:
System.out.println( java.lang.Character().getNumericValue( 'a' ) );
As DrClap said, there is no reason to save a string in ASCII format since it will be saved in unicode format and thus Java already knows what the ASCII values will be.
If you want to output a string in ASCII format, do it like this:
public Vector convert( String input ) {
StringBuffer tmpIn = new StringBuffer( input );
Vector tmpOut = new Vector
for ( int index = 0; index < tmpIn.length; index++ ) {
char tmpCharacter = tmpIn[ index ];
int tmpValue = java.lang.Character().getNumbericValue( tmpCharacter ) );
tmpOut.addElement( tmpValue );
return tmpOut;
And then display each element as you see fit.
Fixing the bugs in this code is an exercise for the reader. If you want to do something like this, you should be thinking about why you want to do this as well as how to do this.

Similar Messages

  • Combined Upgrade and Unicode conversion of Sap 4.6C to ECC6.0

    Hello all,
    my project team intends to carry out a combined upgrade and unicode conversion of an SAP ERP 4.6C system with MDMP to ECC6.0 (no enhancement package). The system is running on Oracle 10.2.
    In preparation for this upgrade, I have gone through the SAP notes 928729, 54801.
    We need to get a rough estimate of the entire downtime so as to alert our end users. From the CU&UC documentation in 928729, I read up note 857081. However the program in this note cannot be used to estimate the downtime as my system is < SAP netweaver 6.20.
    Is there any other SAP note or tool or program that I can use to estimate the downtime for the entire CU&UC? Thanks a lot!

    Hi,
    Combined upgrade depend upon number of factors like database size, resources on the server and optimization. In order to get idea of how much downtime, it will take, I would suggest you to do combined upgrade and unicode conversion on sandbox system which should be the replica of your production system. And try to optimize it. From there you can get approx. downtime required.
    Also, please read combined upgrade and unicode conversion guides on  http://service.sap.com/unicode@sap
    Thanks
    Sunny

  • 4.7EEx1.10 to ECC6.0 upgrade and Unicode conversion

    Hi Experts,
    We are going to initiate the upgrade from next month onwards. Subsequently i have started preparing the plan and strategy for the same.
    As our current setup is 4.7EEx110/Win 2003 R2-64 bit/Oracle 10.2.0.4.0 (Non unicode). And we have recently migrated on to this setup from WIn2k 32 bit. Also the current hardware is Unicode compatible.
    With respect to strategy for achieving this Upgrade and Unicode conversion, i am planning as follows.
    Step 1) Perform Unicode conversion on the current landscape (Both Export/import on the same servers)
    Step 2) Setup Temporary landscape as part of Dual maintenance strategy and migrate data from the current systems to temporary systems using backup/restore method.
    Step 3) Perform the SAP version upgrade on the current landscape and setup transport routes from temporary to current landscape in order to keep it in sync
    Step 4) after successful upgrade, decommission the temporary landscape
    Please provide your suggestions and valuable advices if there is anything wrong with my strategy and execution plan.
    Regards,
    Dheeraj

    Hi,
    Thanks. As i have already referred these notes as i am seeking advise with respect to my upgrade approach.
    However i have planned to perform in the following manner.
    1) Refresh Sandbox with Prod data and perform Upgrade to ECC6.0 EHP5 & subsequently Unicode conversion on the same server (Since both export & Import has to perform on the same hardware as we have recently migrated on this hardware which is Unicode compatible)
    2) Setup temporary landscape for DEv & QAs and establish transport connection to Production system in order to move urgent changes
    3) Keep a track of the changes which have transported during upgrade phase so that the same can be implemented in the upgraded systems i.e. Dev & QAS
    4) After Sandbox Migration and signoff, we will perform Dev & QAS upgrade & unicode conversion on the same hardware (Note: Since these are running on VMware can we export the data from the upgraded system and import on to a new VM?)
    5) Plan for production cutover and Upgrade the Prod system to ECC6.0 Ehp5 and then Unicode conversion. As i am planning to perform upgrade over the weekend and then Unicode conversion activity in the next weekend (Is it a right way?)
    My Production setup: DB on one Physical host and CI on separate Virtual host
    6) After the stabilization phase, we are planning for OS & DB upgrade as follows:
          a) Windows upgrade from 2003 R2 to Windows 2008 R2
          b) Oracle Upgrade from 10.2 to 11.2
    If anyone thinks that there is anything wrong with my above approach and need changes then please revert.
    I have one more doubt as I am going to upgrade 4.7EEx110 (WAS 620, Basis SP64) to ECC6.0 EHp5.As I presume that I can straight away upgrade from the current version to ECC6.0 Ehp5 without installing EHP. Kindly confirm
    Thanks

  • Combined Upgrade and Unicode conversion question

    Hello Everyone,
    I will be performing combined Upgrade and Unicode conversion soon. Currently i have run Prepare and do not have any errors.
    I have already run SPUMG consistency check and i do not have any errors there. Since this is Combined Upgrade and unicode conversion according to guide i do not need to do the Nametab conversion right now. But now if i go this place:
    SPUMG -> Status -> Additional Information  , i see a status with red for Unicode nametabs are not consistent or not up-to-date.
    Please let me know if i can ignore this step and do the nametab conversion after upgrade is complete and before unicode conversion.
    Thanks,
    FBK

    Please follow the instructions from the guides.
    The Unicode nametabs will be generated automatically during the upgrade.
    An additional check is integrated into the final preparation steps in the target releases.
    Regards,
    Ronald

  • Combined upgrade and Unicode conversion for ECC5 MDMP system

    Hello,
    We are planning to do Upgrade and Unicode conversion of ECC5 MDMP system to ECC6 EHP4 Unicode. We are adopting Combined upgrade and Unicode conversion strategy to minimise the downtime.
       In source version ECC5 we are in support pack level 6. Should we need to update the support pack to any target version to start with CU&UC or we can start with ECC5 with SP 6 itself.
    Since we cant afford more downtime for support pack update also, is it ok to start with upgrade and unicode conversion with current version.
    please advice.
    Regards
    Vinay

    Hello Vinay,
    please note that as a prerequisite the Basis SP should be accurate for an MDMP conversion.
    There is no MUST to have the latest Basis SP, but without you could have severe issues in SPUMG.
    On the application side, there are in most cases no hard requirements on the SP level.
    Best regards,
    Nils Buerckel
    SAP AG

  • Where is the Combined Upgrade and Unicode Conversion Guide

    Hi All
    Embarassing question time.
    I am after the Combined Upgrade and Unicode Conversion Guide for 4.7 to ERP 6.0, but can only find the Combined Upgrade and Unicode Conversion Guide for 46C to ERP 6.0.
    Can anyone advise where the 4.7 guide is.
    Thanks
    Sam

    Thank God SAP don't include it in the Install guide. The Install Guides are complex already. BTW if you need more info on unicode and its conversion go here
    https://service.sap.com/unicode@sap

  • Convert smart quotes and other high ascii characters to HTML

    I'd like to set up Dreamweaver CS4 Mac to automatically convert smart quotes and other high ASCII characters (m-dashes, accent marks, etc.) pasted from MS Word into HTML code. Dreamweaver 8 used to do this by default, but I can't find a way to set up a similar auto-conversion in CS 4.  Is this possible?  If not, it really should be a preference option. I code a lot of HTML emails and it is very time consuming to convert every curly quote and dash.
    Thanks,
    Robert
    Digital Arts

    I too am having a related problem with Dreamweaver CS5 (running under Windows XP), having just upgraded from CS4 (which works fine for me) this week.
    In my case, I like to convert to typographic quotes etc. in my text editor, where I can use macros I've written to speed the conversion process. So my preferred method is to key in typographic letters & symbols by hand (using ALT + ASCII key codes typed in on the numeric keypad) in my text editor, and then I copy and paste my *plain* ASCII text (no formatting other than line feeds & carriage returns) into DW's DESIGN view. DW displays my high-ASCII characters just fine in DESIGN view, and writes the proper HTML code for the character into the source code (which is where I mostly work in DW).
    I've been doing it this way for years (first with GoLive, and then with DW CS4) and never encountered any problems until this week, when I upgraded to DW CS5.
    But the problem I'm having may be somewhat different than what others have complained of here.
    In my case, some high-ASCII (above 128) characters convert to HTML just fine, while others do not.
    E.g., en and em dashes in my cut-and-paste text show as such in DESIGN mode, and the right entries
        &ndash;
        &mdash;
    turn up in the source code. Same is true for the ampersand
        &amp;
    and the copyright symbol
        &copy;
    and for such foreign letters as the e with acute accent (ALT+0233)
        &eacute;
    What does NOT display or code correctly are the typographic quotes. E.g., when I paste in (or special paste; it doesn't seem to make any difference which I use for this) text with typographic double quotes (ALT+0147 for open quote mark and ALT+0148 for close quote mark), which should appear in source code as
        &ldquo;[...]&rdquo;
    DW strips out the ASCII encoding, displaying the inch marks in DESIGN mode, and putting this
        &quot;[...]&quot;
    in my source code.
    The typographic apostrophe (ALT+0146) is treated differently still. The text I copy & paste into DW should appear as
        [...]&rsquo;[...]
    in the source code, but instead I get the foot mark (both in DESIGN and CODE views):
    I've tried adjusting the various DW settings for "encoding"
        MODIFY > PAGE PROPERTIES > TITLE/ENCODING > Encoding:
    and for fonts
        EDIT > PREFERENCES > FONTS
    but switching from "Unicode (UTF-8)" to "Western European" hasn't solved the problem (probably because in my case many of the higher ASCII characters convert just fine). So I don't think it's the encoding scheme I use that's the problem.
    Whatever the problem is, it's caused me enough headaches and time lost troubleshooting that I'm planning to revert to CS4 as soon as I post this.
    Deborah

  • Unicode in UNICHAR and UNICODE Excel Functions Is Decimal

    CASE # 12 64 08 79 83
    Dear Microsoft Engineers,
    There is a lack of information in  Microsoft Support pages*, where UNICODE and  UNICHAR in Excel 2013 are out of real context, given that unicode is always hexadecimal.
    Please add a notice on these pages about the fact that these Excel functions process decimal unicodes.  You might also add a hint to use HEXDEC and DECHEX conversion when working with UNICHAR and UNICODE.
    Please note that low decimal unicodes equal ASCII.  To highlight the new performance, you'd better take some other examples.
    I need UNICHAR in my Excel developement tool related to a Unicode-using application (MSKLC).
    I contacted Microsoft Support by phone today and got the above case ID.
    Best regards,
    Marcel Schneider
    P.S.:  My first post noted these functions to be ASCII.  So I am sorry not to have considered the system (whether it is hexadecimal, or decimal!).
    * Note:  I was not allowed to post this with hyperlinks to the Support Pages.  Links are the following:
       http://office.microsoft.com/en-us/excel-help/unicode-function-HA102753274.aspx
       http://office.microsoft.com/en-gb/excel-help/unichar-function-HA102753273.aspx

    Hi Marcel,
    Thanks for your feedback, I'll collect the information and submit it with internal ways.
    Have a good time.
    Regards,
    George Zhao
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Perform unicode to UTF-8 conversion on F110 bacs payment file in ABAP

    Hi,
    I am facing a conversion issue for the UK BACS payment files.
    The payment run tcode F110 creates a payment file but the file when created on the application server has soem sort of code conversion. If I removed the # value, i can read most of the data.
    The data example is as below-
    #V#O#L#1#0#0#1#5#8#8# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #2#4#3#3#0#9#
    #H#D#R#1#A#2#4#3#3#0#9#S# # #1#2#4#3#3#0#9#0#0#0#0#0#2#0#0#0#1#0#0#0#1# # # # # # # #1#0#1#1#2#
    #H#D#R#2#F#0#2#0#0#0#0#0#1#0#0# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    #U#H#L#1# #1#0#1#1#3#9#9#9#9#9#9# # # # #0#0#0#0#0#0#0#0#1# #D#A#I#L#Y# # #0#0#0# # # # # # # #
    This is then transferred to the bank via the FTP UNIX Script but after the conversion which is happening as-
    #Perform unicode to UTF-8 conversion on bacs file
    $a = "iconv -f UNICODE -t UTF-8 $tmpUNI > $tmpASC";
    The need going forward is to bring the details via the interface and then make an uplaod.
    The ABAP code should be able to make the conversion, remove the additional chracters and then send the file across.
    I have searched everywhere but I am not able to find out how to make the same conversion in ABAP.
    We are on ECC6.
    Can someone please help me?
    Regards,
    Archana

    Hi Archana,
    can  you please check SAP notes 1064779 and 1365764 (including the attachment) and see if this helps you ?
    Best regards,
    Nils Buerckel
    SAP AG

  • File_To_File: UTF-8 to ASCII format conversion.

    HI Experts,
    I got one requirement File_To_File scenario source file is in UTF-8 format so we need to convet it into ASCII fromat , in this one mapping not required so please can you please help me out. we are using  Pi 7.0 with SP 21.
    Regards,
    Prabhakar.A

    in the communication channel define ASCII as enconding.
    Processing Tab Page
    Processing Parameters
       File Type
    Specify the document data type.
    ○       Binary
    ○       Text
    Under File Encoding, specify a code page.
    The default setting is to use the system code page that is specific to the configuration of the installed operating system. The file content is converted to the UTF-8 code page before it is sent.
    Permitted values for the code page are the existing Charsets of the Java runtime. According to the SUN specification for the Java runtime, at least the following standard character sets must be supported:
    ■       US-ASCII
    Seven-bit ASCII, also known as ISO646-US, or Basic Latin block of the Unicode character set
    ■       ISO-8859-1
    ISO character set for Western European languages (Latin Alphabet No. 1), also known as ISO-LATIN-1
    ■       UTF-8
    8-bit Unicode character format
    ■       UTF-16BE
    16-bit Unicode character format, big-endian byte order
    ■       UTF-16LE
    16-bit Unicode character format, little-endian byte order
    ■       UTF-16
    16-bit Unicode character format, byte order
    Note
    Check which other character sets are supported in the documentation for your Java runtime implementation.

  • Diacritic: unicode to ascii

    I'm looking for an algorithm to convert Unicode ro ASCII characters. The algorithm does not have to cover all unicode characters, but Latin1 and Latin 2 should be covered. If the character cannot be converted (no representation in ascii), then i can do it manually (or use a "?")
    thanx.
    trev

    From your title I assume you want to just drop any diacritics attached to the characters?
    Some time ago I downloaded a file from the Unicode site which contains lines like010C;LATIN CAPITAL LETTER C WITH CARON;Lu;0;L;0043 030C;;;;N;LATIN CAPITAL LETTER C HACEK;;;010D;This contains the Unicode description of the character &#x010c; in particular that it can be decomposed to 0043 (C) and 030C (combining hook above). I don't see that property exposed in the java.lang.Character class, but you could use it to create a hard-coded mapping table.

  • DB_CRYPTO_PASSWORD and Unicode

    Hi,
    with DB_CRYPTO_PASSWORD you get different encodings for the same cleartext-pwd on unicode- and non-unicode-systems
    I suppose it depends on the different byte-code of char in unicode and non-unicode.
    You can convert chars from ascii to utf-8 and backwards on both systems, but e.g. 'KARSTEN' at a non-unicode-system (ascii) is '0x4841525354454E' (7 bytes = 7 char) and at a unicode-system converted to ascii '0x4841525354454E00' (8 bytes = 4 char).
    At the unicode-system  with DB_CRYPTO_PASSWORD you can encode these 4 chars but not only the significant 7 bytes - so you get a different result.
    ok, new passwords are now always converted to utf-8 and then encoded, but we also have encoded ascii-passwords stored in a db and need a solution to get the same encoded passwords on a unicode-system.
    Any ideas?
    Kind regards, Karsten

    Hi,
    There is a way to do it, however, it is not yet delivered. Please contact the support for help.
    Regards, Eyal

  • What is diff in Open SQl and Unicode

    Hi.
    What is difference in Open SQl and Unicode.
    What are advantages of Unicode ?

    hi osk,
    <b>u cant compare open sql with unicode as both are different..</b>
    just a small explanation..
    <b>Open SQL</b> consists of a set of ABAP statements that perform operations on the central database in the R/3 System. The results of the operations and any error messages are independent of the database system in use. Open SQL thus provides a uniform syntax and semantics for all of the database systems supported by SAP. ABAP programs that only use Open SQL statements will work in any R/3 System, regardless of the database system in use. Open SQL statements can only work with database tables that have been created in the ABAP Dictionary
    <b>unicode</b>
    Data types such as CHAR ASCII and CHAR EBCDIC are mainly suited to English and central European languages. With other character sets, a code attribute is usually used for these data types. This code attribute uses a different presentation code to ASCII and EBCDIC, even for internal storage in the database system. This causes problems if you want to access these database systems using a different character set, or if you want to exchange data between database systems with different character sets.
    You can avoid these problems by using internal character coding in accordance with UNICODE. Internally, the UNICODE data is stored in UTF-16/UCS-2 format. In UTF-16/UCS-2 format, all characters are two bytes long.
    SAP DB is able to display various presentation codes in UNICODE format
    <b>please close the thread after rewarding the appropriate points...</b>
    Message was edited by: Ashok Kumar Prithiviraj

  • Report on material code, description and all unit of measure conversions

    report on  material code, description and all unit of measure conversions ?
    any ideas?

    Material Number MATNR
    with this key and SPRAS (the desired Language key)
    from MAKT you can get the descriptions..
    and with MATNR from MARM you can get alternative UOM and the conversion rates.
    If you need help on MARM how to get the conversions please notify.
    Hope it helped
    Please reward if found useful
    Best Regards

  • IMessage on MacBook Pro shows i'm my friend. My friend's photo and name shows in every conversation instead of mine. How do I fix this?

    iMessage on MacBook Pro shows i'm my friend. My friend's photo and name shows in every conversation instead of mine. How do I fix this?

    I am using my own Apple ID.  (My father doesn't even have one).  I seem to recall having to select a contact or something to assign to my iMessage app when I used it the first time on my iPad.  I checked the settings and it is set to my apple ID and correct email address.  Any other ideas?

Maybe you are looking for

  • A/R transfer open items from one payer to another

    Hello, has someone transferred open customer invoice items from one payer to another after the new payer was associated with the customer as a partner? which transaction to best use? thanks a lot Patrick

  • Use Moduls with SOAP Sender Adapter

    Hi Experts, I have a question regarding the use of modules in the soap sender adapter / communication channel. Is it correct that the use of modules in the soap sender adapter is not possible? the background of my question is that we use modules from

  • I cant reset my Ipod on Itunes

    I reset my Ipod becuse i couldnt see my ipod in Itunes. Now it says i need to connect to Itunes. It can reset on Itunes but when its done, it says i shall connect to Itunes again, when i do that, the same happend again and again. What can i do ?

  • Advice for songs in a specific year

    I need to make a playlist of songs from my 5000 song library that are from a specific year. All songs have years atached inthe info - but it can be when the album was released - if it's a compliation it can be wrong. Anyone know of a URL link or some

  • Nested Tab Pages in 100% Generated Forms

    Hi all, Creating a Forms (9i) application, hopefully to be 100% Designer 9.0.2.6 generated. Trying to find out if it is possible to generate nested tab pages. eg. example table structure Employee |-Employee history |-Employee skills | |--Employee ski