String utf-16 conversion
Hello,
I call rfc (via xi) and get result as flat xml String from r/3.
This string contains english and hebrew characters. The english is o.k. but the value nodes in hebrew looks like " ׳ ׳�׳ ׳�׳׳ ׳׳�׳¨׳׳/׳׳׳�׳� "
how can i convert the string in order to see my language characters?
I think the source unicode is utf-8, and i need to convert it to utf-16 but i'm not sure about that nor how to do that.
Thanks for your help.
Roni.
Hi Roni,
If your RFC returns an XML file as a java.lang.String object, the String itself is by definition UTF-16. To see if the XML file is correct, you could write it to disk and open it with your favourite text editor. Something like this.
private void save(String xml) throws IOException {
OutputStream out = new FileOutputStream(new File("/tmp/result.xml"));
out.write(xml.getBytes("UTF-8"));
out.close();
Or whatever supported encoding you like and that's supported by your text editor, e.g. ISO-8859-8 is Latin/Hebrew Alphabet; see http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html
Obviously, to correctly see the characters you need the necessary fonts too.
In case the above doesn't work, it means the xml String you receive from the RFC call is already corrupt. However, if it does work, the RFC as such works correctly.
The next step is likely to parse the XML to extract the information you need and store it in your Web Dynpro context. An XML parser usually expects bytes (a java.io.InputStream) as input, which means you need to convert the String to bytes and by doing that, you need to choose a character encoding. It could be something like the following.
SAXParserFactory.newInstance().newSAXParser().parse(new ByteArrayInputStream(xml.getBytes("UTF-8")), handler);
Note that the character encoding you specify here does make a difference. It should be the same, in order not to "confuse" the XML parser, as defined in the XML file's document type declaration, e.g. <?xml version="1.0" encoding="UTF-8"?>
BTW, what exactly do you do with the received XML to obtain the value nodes?
Kind regards,
Sigiswald
Similar Messages
-
Missing charsets in STring to FontSet conversion
Hi,
After installed SUn OS 10, I am trying to install SMC and I got a warning error: Missing Charsets in String to FontSet conversion. Cannot convert string "-monotype_arrial-regular-r-normal --*-140-*-*-p-*-iso8859-2" to type FonsStruct
and so on, with different font types. etc....
How can I find out which fontset in the Unix box? How can I permanent set it back to UTF-8 w/o re install OS again?
Thanks
HSToo bad Lily didn't follow up on TommyReynolds' suggestion. I'm also having the same problem ( I think ).
TommyReynolds does say how to get the installed list, but doesn't say how to find out what's missing.
My settings:
[root@OEL5u4DB11gR2 X11]# rpm -qa 'xorg*font*' | /bin/sort
xorg-x11-fonts-100dpi-7.1-2.1.el5
xorg-x11-fonts-75dpi-7.1-2.1.el5
xorg-x11-fonts-base-7.1-2.1.el5
xorg-x11-fonts-ISO8859-1-100dpi-7.1-2.1.el5
xorg-x11-fonts-ISO8859-1-75dpi-7.1-2.1.el5
xorg-x11-fonts-misc-7.1-2.1.el5
xorg-x11-fonts-truetype-7.1-2.1.el5
xorg-x11-fonts-Type1-7.1-2.1.el5
xorg-x11-font-utils-7.1-2
[root@OEL5u4DB11gR2 X11]# uname -a
Linux OEL5u4DB11gR2 2.6.18-164.el5 #1 SMP Thu Sep 3 02:16:47 EDT 2009 i686 i686 i386 GNU/Linux
[root@OEL5u4DB11gR2 X11]# xclock &
[1] 5950
[root@OEL5u4DB11gR2 X11]# Warning: Missing charsets in String to FontSet conversion
I would greatly appreciate any input.
Kind regards,
UFP1701 -
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,
ArchanaHi 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 -
Error Warning: Missing charsets in String to FontSet conversion
Hi
I was installed aqualogic BPM version 6.0 MP4 for weblogic on solaris 10 SPARC
when i ran albpmadmcenter i got an error
bash-3.00$./albpmadmcenter
Warning: Missing charsets in String to FontSet conversion
Warning: Missing charsets in String to FontSet conversion
any solution?
thanks.I just found this on the web at http://www-01.ibm.com/support/docview.wss?uid=swg21146408.
When I ran "export LC_ALL=C" and then ran xclock, I did not get the message. This might work for you.
Paul -
Problem with String to Int conversion
Dear Friends,
Problem with String to Int conversion
I am having a column where most of the values are numeric. Only 4 values are non numeric.
I have replaces those non numeric values to numeric in order to maintain the data type.
CASE Grade.Grade WHEN 'E4' THEN '24' WHEN 'E3' THEN '23' WHEN 'E2' THEN '22' WHEN 'E1' THEN '21' ELSE Grade.Grade END
This comes the result as down
Grade
_0_
_1_
_10_
_11_
_12_
_13_
_14_
_15_
_16_
_17_
_18_
_19_
_2_
_20_
_21_
_22_
_23_
_24_
_3_
_4_
_5_
_6_
_7_
_8_
_9_
Refresh
Now I want to convert this value to numeric and do some calculation
So I changed the formula as below
cast (CASE Grade.Grade WHEN 'E4' THEN '24' WHEN 'E3' THEN '23' WHEN 'E2' THEN '22' WHEN 'E1' THEN '21' ELSE Grade.Grade END as INT)
Now I get the following error
View Display Error
_ Odbc driver returned an error (SQLExecDirectW)._
Error Details
Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
_State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17001] Oracle Error code: 1722, message: ORA-01722: invalid number at OCI call OCIStmtFetch. [nQSError: 17012] Bulk fetch failed. (HY000)_
SQL Issued: SELECT cast ( CASE Grade.Grade WHEN 'E4' THEN '24' WHEN 'E3' THEN '23' WHEN 'E2' THEN '22' WHEN 'E1' THEN '21' ELSE Grade.Grade END as Int) saw0 FROM "Human Capital - Manpower Costing" WHERE LENGTH(CASE Grade.Grade WHEN 'E1' THEN '20' WHEN 'E2' THEN '21' WHEN 'E3' THEN '22' WHEN 'E4' THEN '23' ELSE Grade.Grade END) > 0 ORDER BY saw_0_
Refresh
Could anybody help me
Regards
Mustafa
Edited by: Musnet on Jun 29, 2010 5:42 AM
Edited by: Musnet on Jun 29, 2010 6:48 AMDear Kart,
This give me another hint, Yes you are right. There was one row which returns neither blank nor any value.
I have done the code like following and it works fine
Thanks again for your support
Regards
Code: cast (CASE (CASE WHEN Length(Grade.Grade)=0 THEN '--' ELSE Grade.Grade END) WHEN 'E4' THEN '24' WHEN 'E3' THEN '23' WHEN 'E2' THEN '22' WHEN 'E1' THEN '21' when '--' then '-1' ELSE Grade.Grade END as Int) -
i have proubleam with string to date conversion, i out put date fromat is 2012-04-30T23:48:55.727-07:00 . so please help me the format conversion.
i wrote the method but it not workig
My method is
-(NSDate *)dateformstr:(NSString *)str
NSString *date = [str stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSDateFormatter *dateFormate = [[NSDateFormatter alloc] init];
[dateFormate setDateFormat:@"yyyy-MM-dd'T'HH:mm:sssZZZZ"]
// NSDate *formatterDate = [dateFormate dateFromString:str];
return formatterDate;
but i did not the value and if i try othere formate i is working but my requiremet format is 2012-04-30T23:48:55.727-07:00.
can any help it out in this senario.Sorry Butterbean, but I'm interested in the answer to your question myself.
I've spent a few hours transfering my library from one computer to another and then find out that my ratings didn't transfer. Like you, I've spent many hours rating my 2000+ songs. I'm sure you have more, nevertheless, I want to find out how to get those ratings. They still show in my iTunes on my laptop but, when I go to the iTunes folder and display the details of at song, no rating is there. If you find out how to get them to display there in the iTunes folder, it seems that would be the key.
Hope you get your answer soon. -
Warning: Missing charsets in String to FontSet conversion
Hi ,
I just installed eclipse on a linux box abd while running eclipse i get the folowwing error -
Warning: Missing charsets in String to FontSet conversion
and the font looks distorted with blocks between alphabetsdid you fix this problem? I'm getting the same error :
[bmollett@hextall ~]$ Warning: Missing charsets in String to FontSet conversion
Warning: Cannot convert string "-*-*-medium-r-*-*-*-120-*-*-*-*-*-*" to type FontSet
Warning: Missing charsets in String to FontSet conversion
Warning: Unable to load any usable fontset
Warning:
Name: FONTLIST_DEFAULT_TAG_STRING
Class: XmRendition
Conversion failed. Cannot load font.
Warning:
Name: FONTLIST_DEFAULT_TAG_STRING
Class: XmRendition
Conversion failed. Cannot load font.
Warning:
Name: FONTLIST_DEFAULT_TAG_STRING
Class: XmRendition
Conversion failed. Cannot load font.
Warning: No font found.
Warning:
Name: FONTLIST_DEFAULT_TAG_STRING
Class: XmRendition
Conversion failed. Cannot load font.
Warning:
Name: FONTLIST_DEFAULT_TAG_STRING
Class: XmRendition
Conversion failed. Cannot load font.
Warning:
Name: FONTLIST_DEFAULT_TAG_STRING
Class: XmRendition
Conversion failed. Cannot load font.
JVMDG217: Dump Handler is Processing Signal 11 - Please Wait.
JVMDG303: JVM Requesting Java core file
JVMDG304: Java core file written to /home/bmollett/javacore.20050804.102118.11000.txt
JVMDG215: Dump Handler has Processed Exception Signal 11.
I've tried both motif and gtk2 versions ... -
String to XML conversion without fatal error?
Can one of you tell me how to convert the folowing string to XML without fatal error?
String s1 = "<?xml version="1.0" encoding="UTF-6.0"?> <Main> <sub> 12345 </sub> </Main>".First, you can't have double quotes (") in a string like that, you need to do (\") instead. If you wrote the below line and saved the file as a file_name.xml It should work fine.
import java.io.*;
public class yourclass{
public static void writeXML(){
try{
File xmlOut = new File("file_name.xml");
BufferedWriter xmlWriter = new BufferedWriter(new FileWriter(xmlOut));
String s1 = "<?xml version=\"1.0\" encoding=\"UTF-6.0\"?> <Main> <sub> 12345 </sub> </Main>";
// you can concatenate the strings using a +
// the \n will create a new line in the file
String s2 = "<?xml version=\"1.0\" encoding=\"UTF-6.0\"?>" + "\n" + "<Main> <sub> 12345 </sub> </Main>";
xmlWriter.write(s1);
xmlWriter.close();
}catch(Exception ex){
ex.printStackTrace();
}There are a few other ways to do this, the one above is sloppy. One is XStream to convert xml to Java objects and back again. http://xstream.codehaus.org/tutorial.html -
Character encoding (unicode to utf-8) conversion problem
I have run into a problem that I can't seem to find a solution to.
my users are copying and pasting from MS-Word. My DB is Oracle with its encoding set to "UTF-8".
Using Oracle's thin driver it automatically converts to the DB's default character set.
When Java tries to encode Unicode to UTF-8 and it runs into an unknown character (typically a character that is in the High Ascii range) it substitutes it with '?' or some other wierd character.
How do I prevent this.my users are copying and pasting from MS-Word. My DB
is Oracle with its encoding set to "UTF-8".Pasting where? Into the database? If they are pasting into the database (however they might do that) and getting bad results then that's nothing to do with Java.
Using Oracle's thin driver it automatically converts
to the DB's default character set.Okay, I will assume that is correct.
When Java tries to encode Unicode to UTF-8 and it
runs into an unknown character (typically a character
that is in the High Ascii range) it substitutes it
with '?' or some other wierd character.This is false. When converting from Unicode to UTF-8 there are no "unknown characters". I don't know what you mean by the "High Ascii range" but if your users are pasting MS stuff into your Java program somehow, then a conversion from something into Unicode is done at that time. If "something" isn't the right encoding then you have the problems already, before you try to write to the DB.
How do I prevent this.First identify the problem. You have input coming from somewhere, then you are writing to the database. Two different steps. Either of them could have a problem. Test them separately so you know which one of them is the problem. -
HI,
im getting IDoc from a Seeburger converter with UTF-8 text string.
is it possible to convert this string or is sap possible to read/show utf-8 string correct ?
we are using ECC6.0 unicode System.
example: Kapitän should be shown as Kapitän
Thanks,
Gordon
Edited by: Gordon Breuer on Oct 17, 2008 12:59 PMwhich locale the other system is using? in SAP you will receive what was sent, so if the sender system sends the correct character, seeburger adaptor should be converting it to correct one in UTF-8. as your SAp system is unicode you should be able to see it properly, if it was correctly sent from the sedning system,and converted in Seeburger.
-
HELP: String to double conversion?
Hello,
I want to convert a String to a double, and then use this double for a calculation. The conversion seems to be ok, but I get an error with the calculation... Please HELP!
A part of my code:
double angle;
Double converted_angle;
angle=jTextField2.getText();
converted_angle= Double.valueOf(angle);
double theta = cos(Math.PI/180*converted_angle);
ERROR: "operator * cannot be applied to double,java.lang.Double"
Thanks in advance.This is happening because you want to multiply a Double object, instead of a double value. Do this:
Double converted_angle; should be double converted_angle;
converted_angle= Double.valueOf(angle); should be changed to converted_angle = Double.parseDouble(angle);
angle should probably be a String.
check this link for your options:
http://java.sun.com/j2se/1.4/docs/api/java/lang/Double.html -
Lost characters (?) in Strings (UTF-8, Chinese)
Hi,
I keep having troubles with "lost" characters in Chinese.
Some Chinese characters in UTF-8 are displayed correctly and also stored correctly in my file, but some other characters just get lost(?) in the string.
Does anybody know what possibly could be the mistake?
thanks for your help
thomasTry the following for testing fonts on your OS.
import java.awt.*;
public class TestFonts{
public static void main(String[] args) throws java.lang.Exception{
String sample = new String(new char[]{(char)0x4e00, (char)0x505a});//choose your own characters in the array char[]
java.awt.Font[] fonts = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
int q=0;
for (int j = 0; j< fonts.length; j++){
q = fonts[j].canDisplayUpTo(sample);
if ((q == -1) ||(q == sample.length())){
System.out.print(fonts[j].getFamily());
System.out.print(" : ");
System.out.println("YES ");
System.out.println();
}//end of for
} -
can n e body tell me how can i convert a String to an int
always remember to use the try/catch block with thins that throw exceptions
String gg;
int in;
try{
gg = "30";
in = Integer.parseInt(gg);
catch(NumberFormatException e){
e.printStackTrace();
}Ant -
String to XML conversion using XSLT
Hi all,
I have a scenario when my source input XML is in the form of a string which needs to be transformed into an XML target fields.
I am using XSLT mapping to do that and its working but unfortunately, input XML contain xml declaration <?xml version='1.0'?>. Because of which it fails.
I need to remove this. Can any body please suggest how to do this?
Any help will be appriciated.
Regards
-KulwantHi,
Refer these links
XI/PI: Convert Flat File to Deeply Nested XML Structures Using Only Graphical Mapping
Regards,
Surya -
Hi,
I need to convert a string to a Date format.
Input string can be in 2 formats: "mm-dd-yy" and "yyyy-mm-dd".
Thanks....java.util.Date date = new java.util.Date();
sd = new java.text.SimpleDateFormat("yyyy-MM-dd");
System.out.println(sd.format(date));
sd = new java.text.SimpleDateFormat("MM-dd-yy");
System.out.println(sd.format(date));
Maybe you are looking for
-
we are using VS 2013, I need to run multiple Coded UI Ordered Tests in parallel on different agents. My requirement : Example: I have 40 Coded UI Test scripts in single solution/project. i want to run in different OS environments(example 5 OS ). I
-
ITunes 10.5.3 corrupting MP3's upon import?
I recently upgraded to iTunes 10.5.3 and have added a few MP3 albums since the update. Various tracks are being corrupted when imported. I have previewed the songs using Finder prior to importing them in iTunes and they play absolutely fine however o
-
I have Silverfast 8 scanner program on my computer Now I have purchased Adobe Photoshop Elements 11. Should I just install this Photoshop Elements 11? Or should I first uninstall SilverFast 8, install Elements 11 and then re-install SilverFast 8 agai
-
Airport base station unit?
I've checked my processes with activity monitor and can not figure out why this process is active, (Airport base station unit). I do not have airport enabled in any way and I do not have an airport base unit. Activity monitor tells me this is process
-
Help: will iMovie delete the videos from iPhoto when i get the thumbnails?
i have lots of important videos on iphoto and i am afraid imovie might wipe out all of the videos when it gets the thumbnails. has this ever happened to anyone before?