Korean characters, not handled through JNI

Hello:
I have a C library that is wrapped through JNI. The data is in Korean, and is returning fine in the C code, but then when I access the data through Java (JString), it is all messed up. Any ideas what is the problem?
Thanks,
[email protected]

Adding on, here is the snippet code, where a command is passed in. The C code executes the command, and returns the result. The UTF and jstring string manipulations are shown below. What is wrong with the assumption if the data itself is of Korean language (double-byte enabled)? Any response would be greatly appreciated. Please respond to this message board, or email at [email protected]
Thanks,
Bilal
JNIEXPORT jshort JNICALL
Java_execCliCommand(
JNIEnv *env, jobject obj, jstring cliCmd, jobject cliOutObj)
jshort jresult;
P_HANDLE cliOut = (P_HANDLE)NULL;
char cliOutBuf = (char )NULL;
jclass jcliOutClass;
jfieldID joutbufID;
jstring jcliOutStr;
* Get the cli command & connectstring and execute the cli.
const char cliCmdStr = (env)->GetStringUTFChars(env, cliCmd, 0);
printf("CLI COMMAND : %s\n", (char *)cliCmdStr);
jresult = cliRunServerCommand((char *)cliCmdStr, &cliOut);
jcliOutClass = (*env)->GetObjectClass(env, cliOutObj);
joutbufID = (*env)->GetFieldID(env, jcliOutClass, "outbuf", "Ljava/lang/String;");
if ( cliOutBuf != NULL ) {
printf("CLI RESULTS: %s\n", cliOutBuf);
jcliOutStr = (*env)->NewString(env, (jchar *)cliOutBuf, (jsize)(p_strlen(cliOutBuf)+1));
printf("UNICODE CLI RESULTS: %s\n", (char *)(*env)->GetStringChars(env, jcliOutStr,0));
} else {
jcliOutStr = (*env)->NewStringUTF(env, "Command executed successfully");
(*env)->SetObjectField(env, cliOutObj, joutbufID, jcliOutStr);
(*env)->ReleaseStringUTFChars(env, cliCmd, cliCmdStr);
(*env)->ReleaseStringUTFChars(env, connectString, connectStr);
return jresult;
}

Similar Messages

  • Chinese and Korean characters not displaying in navigation pane

    I have an issue with Chinese and Korean characters not displaying on the tabs in the navigation pane:
    I have 2 RoboHelp projects (using RoboHelp 8 with the updates installed) to generate WebHelp, one in Simplified Chinese, the other Korean. The HTML files, .HHC and .HHK were sent out for translations. I have set the appropriate language in the project settings, everything almost works, except for the text on the Contents, Index, and Search tabs. (I'm not using a skin.) I have read in various threads that the lng file should be edited using the RoboHelp interface, and this seems to be the crux of the problem. The characters do not display correctly through the RoboHelp UI.
    The computer on which I generate the WebHelp is Windows Server 2003, and I do not have the language packs installed. (And am having problems getting hold of the language packs to install to see if this fixes the problem.)
    Aside from installing the language packs, is there anything else I can try to help resolve the problem? (The characters in the content are displaying as expected.)
    Any assistance is greatly appreciated

    Perhaps something in the Translation Info section of this page might help? (The specifics are for Japanese, but I believe the issue would apply to all double-byte languages).
    http://helpware.net/FAR/far_faq.htm#JapComp

  • Korean characters not displaying on itunes

    I transferred my korean music to my macbook from windows computer...In my folder or file, it shows in Korean perfectly fine with no gibberish language. However, when I open them in itunes, in itunes a couple of the songs do not display in the korean characters..instead it shows in gibberish and I don't know how to fix this. Do i have to individually change the songs that are like that ? Not every song is like this. Majority of my songs are fine showing in korean language properly in itunes, but only a select number don't...Please tell me how to fix this. I already tried the ID3 Tags and REverse Unicode. Any other options??

    Everything depends on your NLS parameters. If I do this on Oracle 11g I get:
    select chr(203) from dual;
    C
    ËFor bar coding you should use a special bar code font, e.g.:
    http://www.idautomation.com/font-encoders/oracle-reports/

  • Extended characters not getting through VM properly in JDK1.4 versions

    This is on WIndows platform with regular US keyboard.
    When you type "ALT+0252" (it is �) from your regular (English) keyboard using it's numeric keypad, somewhere in the VM there is translation happening that is converting the numeric value of 252 to 242 and there by displaying the character mapped to ALT+0242 (which is �).
    Similarly, every other extended character is getting translated somewhere thereby displaying the wrong character.
    The way to look at Character Map on Windows platform is Start|Programs|Accessories|System Tools|Character Map.
    Best way to compare what is getting through VM is by running
    regular Notepad (Start | Programs | Accessories | Notepad) and typing
    above character and then running the Notepad that comes with J2SDK install (java -JAR JDKInstallDir\demo\jfc\Notepad\Notepad.jar) and typing the same character.
    You will notice that the regular Notepad displays � when you type ALT+0252 but the java Notepad displays � when you type the same ALT+0252 character.

    Here is the sample code. You can first run it in jdk1.3 environment and enter the extended characters in the textfield. You will notice that they get rendered correctly (such as ALT+0252 gets rendered as �)
    Then try running the same applet in jdk1.4 environment and enter the same extended characters in the textfield and you will notice the difference. ALT+0252 will now get rendered as � which is not correct.
    JComponent class in JDK1.4 seems to be translating the string some how before rendering it.
    Please let me know if you have any ideas or suggestions on this weird behavior in JDK1.4. Thanks.
    import javax.swing.*;
    import java.applet.*;
    import java.awt.event.*;
    import java.awt.*;
    public class DemoApplet extends JApplet
    public JTextField jtf = new JTextField ("Testing");
    public String text = "";
    public void init()
    jtf.addActionListener (new ActionListener() {
    public void actionPerformed(ActionEvent e)
    text = ((JTextField)e.getSource()).getText();
    try {
    System.out.println ("numeric value of text is : " + (int)(text.charAt (0)));
    catch (Exception ex)
    ex.printStackTrace ();
    JPanel pan = new JPanel ();
    pan.add (jtf);
    pan.validate();
    getContentPane().add (pan);

  • Chinese characters not showing [through AIRSQL]

    i would to assume that there's ANISI vs UTF8 issue here but don't have a clue where i can go to tweak this.
    (trying to implement chinese(mandarin) names in the adobe employee directory but i only get ???? instead)
    Any Ideas?

    It is actually the language of the tag of the song that matters, not the language of the song itself. If the song has Chinese tag, then the language must be set to Chinese. Setting the language to Chinese will not affect songs that has English tag. So, if you have only English tag songs and Chinese tag songs, then setting the language to Chinese will work for both. However, if you have Chinese tag songs and Japanese tag songs, then you need to set the language accordingly, depending on whether you are transferring Chinese tag songs or Japanese tag songs.

  • Trying to Load a BufferedImage from a PNG through JNI

    Yes I realize that I can load it directly through Java and not go through JNI, but I need this to test correctly as my C code will aquire images without saving to Disk and I want Java code to manipulate the images without saving to disk. The image Im trying to load is a 800x600 PNG image.
    So I have the code
    import java.io.ByteArrayInputStream;
    import java.io.File;
    import java.io.IOException;
    import java.io.InputStream;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    import com.sun.media.jai.widget.DisplayJAI;
    class ImageLoader{
         static{
              System.loadLibrary("LoadImage");
         private static native byte[] loadImage();
         public static void main(String[] args){
    byte[] f = loadImage();
              InputStream s= new ByteArrayInputStream(f);
              BufferedImage bi;
              try {
                   bi = ImageIO.read(s);
                   displayBufferedImage(bi, "test");
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
          * Utility method for display a BufferedImage.<br>
          * @param  image input image
          * @param  title window title string
         public static void displayBufferedImage(BufferedImage image, String title)
              JFrame frame = new JFrame();
             frame.setTitle(title);
             //frame.getContentPane().add(new DisplayTwoSynchronizedImages(sourceImgBI, resultImgGray));
             frame.getContentPane().add(new JScrollPane(new DisplayJAI(image)));
             //frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             //frame.pack();
             frame.setSize(300,300);
             frame.setLocationRelativeTo( null );
             frame.setVisible(true); // show the frame.
         }and I have the JNI c code as
    char* result;
    JNIEXPORT jbyteArray JNICALL Java_ImageLoader_loadImage
      (JNIEnv * env, jclass jclassj){
                   int fd = open("test.png",  O_RDWR, S_IRUSR|S_IWUSR );
                   int size = (800*600*4);
                   result = (char*)malloc(size);
                   read(fd, result, size);
                   jbyteArray return_result;
                   return_result = env->NewByteArray(800*600);
                   env->SetByteArrayRegion(return_result, 0, 800*600, (jbyte*)result);
                   //free(result);
                   return return_result;
         }but when I try to run the code I get the following error
    javax.imageio.IIOException: Error reading PNG image data
         at com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1287)
         at com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1552)
         at javax.imageio.ImageIO.read(ImageIO.java:1438)
         at javax.imageio.ImageIO.read(ImageIO.java:1342)
         at ImageLoader.main(ImageLoader.java:31)
    Caused by: java.io.EOFException: Unexpected end of ZLIB input stream
         at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:240)
         at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
         at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
         at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
         at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
         at java.io.DataInputStream.readFully(DataInputStream.java:195)
         at com.sun.imageio.plugins.png.PNGImageReader.decodePass(PNGImageReader.java:1084)
         at com.sun.imageio.plugins.png.PNGImageReader.decodeImage(PNGImageReader.java:1188)
         at com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1280)
         ... 4 moreI think that Im on the right track because Java is recognizing that this is a PNG image, but Im not sure whats wrong. I don't know much about the formats, so I know nothing about PNG's, maybe someone else can help me here.
    Note: I ran the code
                   BufferedImage bi2 = ImageIO.read(new File("test.png"));
                   displayBufferedImage(bi2, "test2");and the image loads fine, so there is no issue with the image itself.

                   int fd = open("test.png", O_RDWR, S_IRUSR|S_IWUSR );Why are you opening the image file read/write? Why not read-only?
                   int size = (800*600*4);Here you're assuming the image is 800*600. Are you sure that's the case? Also you should write sizeof int here instead of 4.
                   result = (char*)malloc(size);Here you aren't checking for the possibility that result is null.
                   read(fd, result, size);Here you are ignoring the result returned by read(), so you are ignoring the possibilty that it was 0 or less than 'size'. Either are possible.
                   jbyteArray return_result;
                   return_result = env->NewByteArray(800*600);Here again you aren't testing for return_result == null.
                   env->SetByteArrayRegion(return_result, 0, 800*600, (jbyte*)result);Here you should be checking for Java exceptions. Also you shouldn't be repeating the 800*600 here, make it a constant or a variable somewhere.
                   //free(result);You need that free, otherwise you have a memory leak. If the image really is a constant 800*600 in size I would allocate 'result' on the stack so you don't need to housekeep it.
    Also you are never closing the input file!
    Caused by: java.io.EOFException: Unexpected end of ZLIB input streamSo clearly you didn't read all the image. That could be due to guessing wrong about 800*600 or getting a short read when reading the file.
    I think that Im on the right track because Java is recognizing that this is a PNG imageI agree. It starts like a PNG image, so you read something, but it doesn't end like one, so you didn't read it all.> and the image loads fine, so there is no issue with the image itself.
    Good test. Note that your Java code makes no assumption about the size of the image.

  • JNI with Korean characters anybody??

    Can't handle Korean characters through jstring or jobject. How do I do this? is it a Unicode string or a UTF string? any help would be rewarded!!!

    Have you tried the internationalization board?
    Are the characters you getting from your C code UTF-8 (per your previous post?)

  • Korean characters displays properly in application, but not saved in DB properly

    Korean characters are retrieved and displayed properly in VB6 application.  But upon record insertion, it is not properly saved.  See below before and after screenshots.
    Retrieval and display of original record
    Retrieval and display of saved record
    We have tried with setting of "keeporgmultibyte", "set char_convert off", "ODBC User Specified Character Set cp850", unfortunately nothing worked.
    Please see below for details of our ASE.
    ODBC Driver Installer: Sybase Adaptive Server Enterprise PC Client 12.5.4 GA
    ASE ODBC Driver Version:  12.05.01.510
    ISQL -V
    SELECT @@VERSION
    SP_VERSION
    SP_HELPSORT

    I don't have any direct experience configuring ASE for use with Korean text, however cp850 seems like an odd choice for Korean.  I would expect utf8 (particularly if data in other languages were being stored as well) or cp949. Korean Character Set.
    I don't think version has anything to do with your issue, but why on earth would you still be running on 12.5.4?
    End of Life Notice for Adaptive Server Enterprise (ASE) 12.5.X End of Life Notice: Database Management - Sybase Inc

  • Korean characters are displayed as blank box on the TextField in Galaxy Note 3/Android 4.4/AIR 4.0

    The AIR SDK we used is 1/14/2014 Release - AIR 4.
    The device we have tested on is Samsung Galaxy Note 3/Android 4.4.
    We found that it's quite similar with Bug 3681788 which has been fixed in Beta version 4.0.0.1619.
    We checked the issue again with this beta version, and the result is Chinese characters are shown correctly, but Korean's are still not.
    Bug 3681788: The CCJ languages characters are displayed as blank box on the TextField.
    Hope it can be fixed as soon as possible.

    Japanese Characteres have same issue.
    We tested on ASUS Nexus 7/Android 4.4.2/AIR 4.0 and Japanese characters are displayed as blank box in the TextField.
    The AIR SDK we used is February 20th 2014 Release - AIR 4.
    The device we have tested on is ASUS Nexus 7/Android 4.4.2.
    AIR SDK 3.6 worked fine.
    AIR SDK 3.9 has same issue.
    We tested Chinese on ASUS Nexus 7/Android 4.4.2/AIR 4.0, and Chinese Characters are displayed as blank box in the TextField.
    I doubt that Korean Characters will also displayed as blank box.( Sorry we cannot read or write Korean so we couldn't test it)
    I am guessing GalaxyNote 3(4.4) may also have same issue with Japanese.
    Hope this helps
    Kenta

  • PO Document (View Document) does not display Korean Characters

    Hi,
    We have a situation here. In Production, the asian characters are not being displayed in PO Document
    Navigation: Purchase Orders - > Inquire -> View Document
    Surprisingly, a cloned environment of PROD displays the asian characters fine. Has anyone come across a similar issue?
    This uses the XML Publisher template stylesheets. Both PROD and QA have the same style sheets. The template is setup with language as Korean.
    It would be great if anyone can please guide me troubleshoot this issue and identify the cause.

    Thanks for your response.
    I did check the fonts under $OA_JRE_TOP/jre/lib/fonts and $AF_JRE_TOP/jre/lib/fonts folders in both QA and PROD environments.They are identical and albany fonts do not exist under them. But Korean characters are visible in PDFs generated under QA but not in PROD.
    Is there a profile option set to guide XMLP to a folder for fonts? Please let me know.
    Also, the JDK upgrade happened a couple of weeks before and PROD is pointing to JDK 1.5 but QA is still pointing to JDK 1.4 (cloned from a copy week earlier from PROD upgrade).

  • ZHANWIN device type does not print Korean characters

    Hi All,
    We are trying to print smart forms containing Chinese,Taiwanese and Korean characters from our ECC 6.0
    As per SAP Note 1038413 - Unicode SAPWIN device type for CJK fon, we used the device type ZHANWIN to print smart forms for these characters. 
    But with this device type we are unable to print smart forms with Korean characters. But as per the note, it has to support Korean characters too.
    Please help with this issue.
    Thanks and Regards,
    Subashree

    Hi Subashree,
    it is likely that the problem with ZHANWIN is related to the font used in the form. if you want to print Korean characters via ZHANWIN, you need to specify a Korean font like KPBATANG for the Korean characters in the form. Then this will be mapped to a suitable windows font in windows. If you chosse e.g font COURIER , it is mapped to windosw font Courier New which does nto contain the Korean characters.
    For SWINCF or SWINCFCK the font in SAP is not so impertant. The mapping of the characters in windows is based on the Unicode character range. So as Nils said, SWINCFCK should work regardless of the font in the SAP form.
    Regards,
    Aidan

  • Reports Builder - problem displaying Korean characters

    Client-server setup (database 10G unicode AMERICAN_AMERICA.AL32UTF8, client Windows XP AMERICAN_AMERICA.WE8ISO8859P1) and users have no trouble viewing characters in the application using forms.
    But running the reports through Reports Builder creates inverted question marks instead of Korean characters. The reports are not displayed on the screen, but saved into *.csv file on the server.
    My question:
    1. Is Reports Builder Unicode compliant?
    2. If yes - where and how do we set up the correct NLS_LANG?
    3. If not - what is the solution?
    Thanks, Veronika

    But running the reports through Reports Builder
    creates inverted question marks instead of Korean
    characters. The reports are not displayed on the
    screen, but saved into *.csv file on the server.Is the Windows where you run Reports Builder Korean? What is the Windows Code page (ACP)?
    What version of Reports Builder / Developer Suite?
    You are not running the same report through a Reports server?
    In a general sense, for oci apps, there's a conversion from database character set to client character set when retrieving the data (to match client environment/locale), and likewise a conversion to the database character set when storing character data.
    With Korean (Hangul) characters in the db, these characters should be converted to replacement character such as inverted question mark (¿) when retrieved to a client with character set Latin-1 (iso 8859-1) - since its repertoire includes no Korean characters.
    So, if the client side os is code page 949, you could try indicating a client character set of KO16MSWIN949. (You could try also by "lying" if the code page is different, but then you need to take care to set NLS_LANG as needed as it might affect other apps.)
    Also, read this chapter of the Globalization Support Guide:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14225/ch2charset.htm#i1006750

  • How to type Korean Characters in command prompt of Korean win2k3/XP

    We are not able to type the Korean multi-bytes in command prompt of Korean-Win2k3/XP. But we able to copy paste the Korean characters command prompt successfully. Here we are using “MS-IME2002” as keyboard type
    In case of Korean-Win2k8, able to type through both command prompt by selecting “MS-IME2002” as keyboard type.
    Can any one give the solution... its urgent...

    You can check what your current UI-Culture is by doing:
    Get-UICulture
    You could probably change your UI-Culture by some tips on this link:
    http://blogs.msdn.com/b/powershell/archive/2006/04/25/583235.aspx
    Hican

  • Getting HeapDump on out of memory error when executing method through JNI

    I have a C++ code that executes a method inside the jvm through the JNI.
    I have a memory leak in my java code that results an out of memory error, this exception is caught in my C++ code and as a result the heap dump is not created on the disk.
    I am running the jvm with
    -XX:+HeapDumpOnOutOfMemoryError
    -XX:HeapDumpPath=C:\x.hprof
    Any suggestions?
    Thanks

    I'll rephrase it then.
    I have a java class named PbsExecuter and one static method in it ExecuteCommand.
    I am calling this method through JNI (using CallStaticObjectMethod). sometimes this method causes the jvm to throw OutOfMemoryError and I would like to get a heap dump on the disk when this happens in order to locate my memory leak.
    I've started the jvm with JNI_CreateJavaVM and I've put two options inside the JavaVMInitArgs that is used to create the Jvm. -XX:+HeapDumpOnOutOfMemoryError and -XX:HeapDumpPath=C:\x.hprof
    which supposed to create a heap dump on the disk when OutOfMemoryError occurs.
    Normally if I would execute normal java code, when this exception would occur and I wouldn't catch it the Jvm would crash and the heap dump would be created on the disk.
    Since I need to handle errors in my C++ code I am use ExceptionOccured() and extracts the exception message from the exception it self and write it.
    For some reason when I execute this method through JNI it doesn't create the dump.

  • How do I get the keyboard viewer to display Korean characters

    I am trying to set up my Mac so that I can type in Korean. I followed the instructions here: http://www.foolsworkshop.com/120b/koreanmac.html.
    After adding all the Hangul input methods under the International control panel, I have the flag language menu on the menu bar that lets me switch between typing in English and Korean.
    So far so good, but now I'd like to see a layout of where the Hangul characters are on the keyboard, so that I don't have to guess. The above link says that I can see this by selecting Show Keyboard Window from the language menu. If I select this, however, it brings up a picture of a keyboard with Roman characters on the keys. How do I get it to display a picture of a keyboard with Korean characters?

    Bleech. That's exactly the kind of unpolished UI sloppiness that Apple makes such a big deal about not having. I think the dorky-but-lovable PC guy from the TV ads gets a pass to chew out the insufferably smug Mac hipster guy in Korean.
    Seriously, though, I tried that and it works. Thanks for the tip.

Maybe you are looking for