Display Unicode Character in Swing Objects

I am trying to display Chinese Characters using Swing GUI.
I created Unicode strings using escape character \uXXXX
I displayed \u4e00 successfully
However when I tried to display \ub8db i got a square box displayed instead.
I am using: Winnt ver 4 ,RichWin 97
private Object listData[] = {
new String("\ucfe3\ub8db"), // Two boxes displayed in list
new String("\u4e01\u4e00"), // Characters displayed correctly
new String("Third selection")
To hope to get some replies ASAP. Thanks!!!
Regards,
Patrick

Hi Patrick,
Yeh, fonts are rather ubiquitous when it comes to internationalization. The fact that the font.properties files still exist confuses a lot of people. In reality, Sun doesn't support them any more, and they aren't all that useful if you're actually deploying your code onto other machines.
So, to answer your questions... :D
1) Each component will have a font set on it. To start with, each component will end up with the JDK default, usually the Dialog font in Java. From memory, I think this maps to Arial on Windows systems, though I'm not sure if RichWin alters this in anyway, as I haven't used it myself.
You can check the available fonts on your machine by calling:
GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
This returns an array of strings. You can basically create a new font from any of the names that appear in here. For instance, if one of the strings was "Arial Bold", you could create the following font:
Font myFont = new Font("Arial Bold", Font.PLAIN, 12);
2) The best way is to simply create the font you want on startup. If you can't rely on the font
you need being installed on every machine you plan to run your program on, the best solution is to either install it on startup, or carry it around with you.
Have a look at Font.createFont(), as it allows you to create a new Font object from a *.TTF file (a TrueType font). In JDK1.3, this is buggy, leaving a large temp file behind every time you run it, but I've already tried this under Merlin Beta, and it's fixed and working fine.
The reason this is handy is because the font we keep talking about on here, Arial Unicode MS, is a TrueType font. So you can carry the font around with you, and load it on startup using this call.
Arial Unicode MS is a 23Mb font, but it's capable of displaying just about any character you could imagine.
The trick from there, once you've loaded your font, is to make sure you call setFont() on just about any component you create. Menus are a cow - you've got to listen for events, as the dropdown menus don't always get the font straight away. But other than that, it's fairly simple.
3) The short answer is to call the getAvailableFontFamilyNames() call above, and look for any familiar font names. If you can't find any, you know you're not going to be able to display anything.
Windows seems to have standard fonts for the international languages. In Chinese, this is SimHei for Simplified (mainland) Chinese, and MingLiU for Traditional (Taiwanese) Chinese. Simplified covers about 30,000 Kanji, while Traditional covers around 80,000.
So for Chinese, you would look for "SimHei" and "MingLiU", plus any of the fonts capable of displaying anything, like "Arial Unicode MS". If none of these strings are in the array, you may want to carry the Arial Unicode MS installer around with you and execute it. This file is about 11Mb, and is available as a download off the Microsoft website.
4) Probably about the most useful thing I've come across is the Sun I18N tutorial on this very website. There isn't a heck of a lot out there, unfortunately. About the only other things I can recommend are http://www.unicode.org for the Unicode character codes, and http://www.njstar.com for NJStar Communicator, which you'll find useful if you're working with Chinese.
Oh, and watch this forum, of course. ;D
Hope that helps!
Martin Hughes

Similar Messages

  • ** Plz help me in displaying unicode character **

    Hi,
    I hava a problem with the following code. Actually I want to display some arabic character with the help of unicode. Plz go through the following code.
    import java.awt.*;
    class Unicode extends Frame
    public static void main(String args[])
    Frame f = new Frame("Unicode");
    f.setSize(200,200);
    String str="\u0600";
    TextField tf=new TextField(str);
    f.add(tf);
    f.setVisible(true);
    I m trying to print that character on a textfield. However, this is not the requirement but for only testig purpose. I get the character '?' in the resulting textfield. plz tell me that how can I use unicode to print other languages character anywhere like on awt, swing or in html. plz reply soon . Thanks
    Fahad Ahmed

    \u0600 is an unassigned Unicode character, so there's no way to do that. However I assume you mean you want to display Arabic characters such as \u0627, Arabic Letter Alef (&#x0627). Then you need to find a font that can render those characters properly, and assign that font to the TextField using its setFont() method.
    I notice you are using AWT, which probably means you are trying to do this in an applet. If that's the case then "find a font and use it" is going to be a big problem, because you don't know what fonts your clients' computers have available.

  • How to display unicode character in jsp pages?

    i have to display user need language using unicode character according to user selected in radio button arabic or german in jsp
    pages. can you explain how i have to code?

    Hi,
    Visit the following URL http://java.sun.com/docs/books/tutorial/i18n/ .
    It will help you.
    bye for now
    sat

  • Unicode character not displaying when PDF is created using PDFMaker

    Using Adobe Acrobat Pro 9
    Our company letterhead contains a special character (Unicode 25AA "Black Small Square"). When a PDF is created of a Microsoft Word document (2003 or 2007) using the PDFMaker, that character is not displayed in Acrobat (shows as whitespace). Strangely enough, if I search for the character in that PDF file using the Acrobat search function (query "u/25AA"), the search finds the character, but again, it is displayed as whitespace.
    However, if I create a PDF from that same Word document by printing to Adobe PDF, the character displays correctly in Acrobat. Additionally, if I do a SaveAs to PDF (Using the Microsoft plugin), the character displays correctly in Acrobat. This leads me to believe that muy issue is related to the PDFMaker (as opposed to the PDF printing function) and how the character is embedded into the PDF file. I have tried opening the PDF in other versions of Acrobat, but I get the same result.
    Any suggestions? We would like to utilize the convenience of the PDFMaker for our letters and reports, and not have to use the print function. I can email a sample of all the PDF's I spoke of upon request, but the issue should be reproducable using the following steps:
    1. Open MS Word and type (or copy from the Character Map) unicode character 25AA in Arial font.
    2. Save Word file.
    3. Use PDFMaker to create PDF file.
    4. Open PDF file and view results.
    Any guidance or help is appreciated.
    Phil Hinton

    First, check the fonts in the PDF to be sure that they are not embedded (you are likely correct that there is a problem). What job settings are you using. Try the press or print. Also check the job settings to be sure that ALL fonts are to be embedded.
    Also, check the log file of Distiller (set it to not be deleted in the settings). If there is an issue with the license of the font then the font will not be embedded. In that case you need to find a licensed version of the font or change to a different font.

  • Unicode character not displaying correctly

    when i am stroring Unicode Character in Oracle 8 DB .The Stored Character are not displayed correctly . Through sql client seen as '�' .Altough through JSp it displays correct value 集 (in japanese)
    My client wants to see through sql also same value . Pls help wat is wrong. More info :
    Oracle is set up in UTF-8 Format.
    Using code as below before inserting in DB
    String temp =product.getDescription();
    String newResult = new String(temp.getBytes("UTF-8"), "UTF-8");

    TryString newResult = new String(temp.getBytes(default),>
    "UTF-8");// "default" is a String of the name of
    default encoding on the part of client
    Sorry there was a slip. Try the following.
    String newResult = new String(temp.getBytes(default));

  • Unable to display Chinese character in non-unicode system properly.

    Hi, all
    My system has been upgraded from 4.6C to 6.0 which is non-unicode system. Chinese characters with long length will be cut and cannot wrap automatically. But it's OK to alphabetes. How could I resolve this?
    Thanks..
    TD. Wei

    The simple and easy way to check
    non-unicode character sets are not supported on unicode system any longer. Am I right?
    Transaction code i18N
    Select
    trouble shooting --> printing  test --> smartforms --> multiple scripts, select your output device and see print preview. it will display all supported characters.
    I guess, above information will be useful for closing the thread.
    Regards,
    SaiRam

  • How to display a unicode character in a list ?

    Hi,
    sorry if the question seem to be really easy but I doenbt found of to diaply a special character in a list.
    I thank that it was easy :
    1) display tha windows character map
    2) copy paste the charatcter in the ABAP Program to obtain something like this :
    write '≤'.
    But the displayed character is '#' . So, could you tell me how to display a gived unicode character ?
    Regards,
    morgan

    Hello Morgan,
    you need SAP system with unicode. You can check it from every dynpro/mode:
    System->Status: SAP System dada  Unicode system: yes
    I have checked your sign '≤' on my not UC system: is displayed: '='.
    Bye,
    Peter

  • Unicode character can't display in smartforms.

    Hi everybody!
    When I type some unicode character (like ổ ữ...) into a text in smartforms, that character can't display it converted to "?". I don't know how to display it.
    Thank!

    Make sure you use Cyrillic fonts for displaying unicode characters.
    Mostly, if you preview this character on non-unicode enable printer it may display as junk character.
    Close the thread once your question is answered.
    Regards,
    SaiRam

  • ADF Unicode character ï not displaying fine in af:outputFormatted

    Hi,
    I have a database column that stores unicode characters as : "ï"
    Eg : Helloï
    Now ï represents a Unicode character.
    I am using an af:outputFormatted UI element to display this.
    The encoding for the VO which reads from the database is "UTF-8" and the PageDefinition file for the Page is also "UTF-8"
    But it is not shown as the Unicode Character but rather ï
    I also tried replacing it as \u00E9 and it disn;t work either too.
    Kindly help.

    <af:outputFormatted id="uni" value="#{'&#239;'}"/>
    The above code works for me so assuming your string have the proper value it should also work for you.

  • Unicode character doesn't display integral symbol

    I tried using unicode character 222B in my program to get the integral symbol.
    It works well in jdk1.2, but if i try to run the same program in jdk1.3 , it's returning delta symbol.
    What is the possible solution, such that i get the integral symbol in jdk1.3 as well as both?
    submitted by
    Viru

    Hi Viru,
    Have a look at this piece of code:
    import java.awt.*;
    public class CharacterTest
         public static void main(String[] args)
              Frame f = new ApplicationFrame("Character test")
                   public void paint(Graphics g)
                        Graphics2D g2 = (Graphics2D)g;
                        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
                        Font font = new Font("Arial Unicode MS", Font.PLAIN, 32);
                        g2.setFont(font);
                        g2.drawString("Character \u222B", 40, 80);
              f.setVisible(true);
    [\code]
    I don't have any problems using 32.
    Klint                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Running app doesn't display unicode chars

    So far, i didn't care about character encodings. When i setup a string in java i just used my special characters, like e.g. the german umlauts:
    String text = "�usserlich �berhaupt nicht sch�n."; //html: &Auml;usserlich &uuml;berhaupt nicht sch&ouml;n Then i changed the file encoding in my IDE (eclipse) to UTF-8. The first time i reloaded my source files, i had to replace my texts by retyping my special charaters in the source. I thought that would have been enough.
    But now, such text doesn't display anymore in a Swing component like a JTextField - instead the special characters are replaced by weird (sometimes multiple) other characters.
    The only workaround i've found so far is, to replace all special characters in my source code with the corresp�onding unicode code character "\uxxxx" (backslash + u + 4 chars). But then this would be a step back writing text in the source code. I thought it would be easier to use Unicode ...?

    This post should be under iCloud on the Mac, not icloud.com. If any moderator can move it, that would be great.

  • Create HTML file that can display unicode (japanese) characters

    Hi,
    Product:           Java Web Application
    Operating system:     Windows NT/2000 server, Linux, FreeBSD
    Web Server:          IIS, Apache etc
    Application server:     Tomcat 3.2.4, JRun, WebLogic etc
    Database server:     MySQL 3.23.49, MS-SQL, Oracle etc
    Java Architecture:     JSP (presentation) + Java Bean (Business logic)
    Language:          English, Japanese, chinese, italian, arabic etc
    Through our java application we need to create HTML files that have to display unicode text. Our present works well with English and most of the european character set. But when we tried to create HTML files that will display unidoce text, say japanese, only ???? is getting displayed. Following is the code we have used. The out on the browser displays the japanese characters correctly. But the created file displays only ??? in place of japanese chars. Can anybody tell how can we do it?
    <%
    String s = request.getParameter( "txt1" );
    out.println("Orignial Text " + s);
    //for html output
    String f_str_content="";
    f_str_content = f_str_content +"<HTML><HEAD>";
    f_str_content = f_str_content +"<META content=\"text/html; charset=utf-8\" http-equiv=Content-Type></HEAD>";
    f_str_content = f_str_content +"<BODY> ";
    f_str_content = f_str_content +s;
    f_str_content = f_str_content +"</BODY></HTML>";
    f_str_content = new String(f_str_content.getBytes("8859_9"),"Shift_JIS");
    out.println("file = " + f_str_content);
              byte f_arr_c_buffer1[] = new byte[f_str_content.length()];
    f_str_content.getBytes(0,f_str_content.length(),f_arr_c_buffer1,0);
              f_arr_c_buffer1 = f_str_content.getBytes();
    FileOutputStream l_obj_fout; //file object
    //file object for html file
    File l_obj_f5 = new File("jap127.html");
    if(l_obj_f5.exists()) //for dir check
    l_obj_f5.delete();
    l_obj_f5.createNewFile();
    l_obj_fout = new FileOutputStream(l_obj_f5); //file output stream for writing
    for(int i = 0;i<f_arr_c_buffer1.length;i++ ) //for writing
    l_obj_fout.write(f_arr_c_buffer1);
    l_obj_fout.close();
    %>
    thanx.

    Try changing the charset attribute within the META tag from 'utf-8' to 'SHIFT_JIS' or 'utf-16'. One of those two ought to do the trick for you.
    Hope that helps,
    Martin Hughes

  • Unicode font for swing components

    Hi all,
    I'd like to set a Swing component (a JLabel) to a particular font so it will properly display Unicode Greek text. I've been reading all about physical vs. logical fonts, and I've read through the various Sun docs/faqs on Internationalization, Fonts, and Unicode, but I just can't get this to work. I think I'm missing something more basic here about selecting my font. My test word is the Greek "khairete," with an accent over the iota. Here is the Unicode:
    \u03c7\u03b1\u1f77\u03c1\u03b5\u03c4\u03b5
    The trick is that accented iota.
    I can launch an xterm that shows the characters I want like this:
    $ xterm -fn -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1 &
    That tells me that if I can get Java to use that font, then I'm all set. I'm trying the following test program:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.io.*;
    public class GUI extends JFrame {
    public static final String MESSAGE = "\u03c7\u03b1\u1f77\u03c1\u03b5\u03c4\u03b5";
    public GUI() throws Exception {
    super();
    Font[] fonts;
    Container container;
    JLabel label;
    fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
    for (int j=0;j<fonts.length;j++) {
    System.out.println(fonts[j]);
    container = getContentPane();
    container.setLayout(new GridLayout(0, 1));
    // try with the default font
    label = new JLabel(MESSAGE);
    container.add(label);
    printFont(label.getFont());
    // see what the default font looks like when PLAIN (to compare with fonts below)
    label = new JLabel(MESSAGE);
    label.setFont(label.getFont().deriveFont(Font.PLAIN, 12));
    container.add(label);
    printFont(label.getFont());
    // this looks the same as the default font, meaning we didn't find what we asked for.
    label = new JLabel(MESSAGE);
    label.setFont(new Font("-misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1", Font.PLAIN, 12));
    container.add(label);
    printFont(label.getFont());
    // this also falls back to the default.
    label = new JLabel(MESSAGE);
    label.setFont(Font.getFont("-misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1"));
    container.add(label);
    printFont(label.getFont());
    // this (of course) falls back to the default.
    label = new JLabel(MESSAGE);
    label.setFont(Font.getFont("not a font name"));
    container.add(label);
    printFont(label.getFont());
    // try every font we've got!
    for (int j = 0; j < fonts.length; j++) {
    label = new JLabel(fonts[j] + ": " + MESSAGE);
    label.setFont(fonts[j].deriveFont(Font.PLAIN, 12));
    container.add(label);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    pack();
    show();
    public static void printFont(Font f) {
    System.out.println(f);
    if (f != null) {
    public static void main(String[] args) throws Exception {
    GUI me = new GUI();
    But nothing in this code succeedings in printing \u1f77. As I've said, the plain old xterm can do it. I think my problem is that I haven't successfully referenced the desired font in the Java code. But how do I do this? These are the fonts available to me, according to the code above:
    java.awt.Font[family=Bitstream Charter,name=Bitstream Charter,style=plain,size=1]
    java.awt.Font[family=Bitstream Charter,name=Bitstream Charter Bold,style=plain,size=1]
    java.awt.Font[family=Bitstream Charter,name=Bitstream Charter Bold Italic,style=plain,size=1]
    java.awt.Font[family=Bitstream Charter,name=Bitstream Charter Italic,style=plain,size=1]
    java.awt.Font[family=Courier,name=Courier,style=plain,size=1]
    java.awt.Font[family=Courier 10 Pitch,name=Courier 10 Pitch,style=plain,size=1]
    java.awt.Font[family=Courier 10 Pitch,name=Courier 10 Pitch Bold,style=plain,size=1]
    java.awt.Font[family=Courier 10 Pitch,name=Courier 10 Pitch Bold Italic,style=plain,size=1]
    java.awt.Font[family=Courier 10 Pitch,name=Courier 10 Pitch Italic,style=plain,size=1]
    java.awt.Font[family=Courier,name=Courier Bold,style=plain,size=1]
    java.awt.Font[family=Courier,name=Courier Bold Italic,style=plain,size=1]
    java.awt.Font[family=Courier,name=Courier Italic,style=plain,size=1]
    java.awt.Font[family=Cursor,name=Cursor,style=plain,size=1]
    java.awt.Font[family=Lucida Bright,name=Lucida Bright Demibold,style=plain,size=1]
    java.awt.Font[family=Lucida Bright,name=Lucida Bright Demibold Italic,style=plain,size=1]
    java.awt.Font[family=Lucida Bright,name=Lucida Bright Italic,style=plain,size=1]
    java.awt.Font[family=Lucida Bright,name=Lucida Bright Regular,style=plain,size=1]
    java.awt.Font[family=Lucida Sans,name=Lucida Sans Demibold,style=plain,size=1]
    java.awt.Font[family=Lucida Sans,name=Lucida Sans Demibold Oblique,style=plain,size=1]
    java.awt.Font[family=Lucida Sans,name=Lucida Sans Oblique,style=plain,size=1]
    java.awt.Font[family=Lucida Sans,name=Lucida Sans Regular,style=plain,size=1]
    java.awt.Font[family=Lucida Sans Typewriter,name=Lucida Sans Typewriter Bold,style=plain,size=1]
    java.awt.Font[family=Lucida Sans Typewriter,name=Lucida Sans Typewriter Bold Oblique,style=plain,size=1]
    java.awt.Font[family=Lucida Sans Typewriter,name=Lucida Sans Typewriter Oblique,style=plain,size=1]
    java.awt.Font[family=Lucida Sans Typewriter,name=Lucida Sans Typewriter Regular,style=plain,size=1]
    java.awt.Font[family=Luxi Mono,name=Luxi Mono Bold,style=plain,size=1]
    java.awt.Font[family=Luxi Mono,name=Luxi Mono Bold Oblique,style=plain,size=1]
    java.awt.Font[family=Luxi Mono,name=Luxi Mono Oblique,style=plain,size=1]
    java.awt.Font[family=Luxi Mono,name=Luxi Mono Regular,style=plain,size=1]
    java.awt.Font[family=Luxi Sans,name=Luxi Sans Bold,style=plain,size=1]
    java.awt.Font[family=Luxi Sans,name=Luxi Sans Bold Oblique,style=plain,size=1]
    java.awt.Font[family=Luxi Sans,name=Luxi Sans Oblique,style=plain,size=1]
    java.awt.Font[family=Luxi Sans,name=Luxi Sans Regular,style=plain,size=1]
    java.awt.Font[family=Luxi Serif,name=Luxi Serif Bold,style=plain,size=1]
    java.awt.Font[family=Luxi Serif,name=Luxi Serif Bold Oblique,style=plain,size=1]
    java.awt.Font[family=Luxi Serif,name=Luxi Serif Oblique,style=plain,size=1]
    java.awt.Font[family=Luxi Serif,name=Luxi Serif Regular,style=plain,size=1]
    java.awt.Font[family=Utopia,name=Utopia Bold,style=plain,size=1]
    java.awt.Font[family=Utopia,name=Utopia Bold Italic,style=plain,size=1]
    java.awt.Font[family=Utopia,name=Utopia Italic,style=plain,size=1]
    java.awt.Font[family=Utopia,name=Utopia Regular,style=plain,size=1]
    java.awt.Font[family=dialog,name=dialog,style=plain,size=1]
    java.awt.Font[family=dialog,name=dialog.bold,style=plain,size=1]
    java.awt.Font[family=dialog,name=dialog.bolditalic,style=plain,size=1]
    java.awt.Font[family=dialog,name=dialog.italic,style=plain,size=1]
    java.awt.Font[family=dialoginput,name=dialoginput,style=plain,size=1]
    java.awt.Font[family=dialoginput,name=dialoginput.bold,style=plain,size=1]
    java.awt.Font[family=dialoginput,name=dialoginput.bolditalic,style=plain,size=1]
    java.awt.Font[family=dialoginput,name=dialoginput.italic,style=plain,size=1]
    java.awt.Font[family=monospaced,name=monospaced,style=plain,size=1]
    java.awt.Font[family=monospaced,name=monospaced.bold,style=plain,size=1]
    java.awt.Font[family=monospaced,name=monospaced.bolditalic,style=plain,size=1]
    java.awt.Font[family=monospaced,name=monospaced.italic,style=plain,size=1]
    java.awt.Font[family=sansserif,name=sansserif,style=plain,size=1]
    java.awt.Font[family=sansserif,name=sansserif.bold,style=plain,size=1]
    java.awt.Font[family=sansserif,name=sansserif.bolditalic,style=plain,size=1]
    java.awt.Font[family=sansserif,name=sansserif.italic,style=plain,size=1]
    java.awt.Font[family=serif,name=serif,style=plain,size=1]
    java.awt.Font[family=serif,name=serif.bold,style=plain,size=1]
    java.awt.Font[family=serif,name=serif.bolditalic,style=plain,size=1]
    java.awt.Font[family=serif,name=serif.italic,style=plain,size=1]
    javax.swing.plaf.FontUIResource[family=Dialog,name=Dialog,style=bold,size=12]
    java.awt.Font[family=Dialog,name=Dialog,style=plain,size=12]
    java.awt.Font[family=dialog,name=-misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1,style=plain,size=12]
    javax.swing.plaf.FontUIResource[family=Dialog,name=Dialog,style=plain,size=12]
    javax.swing.plaf.FontUIResource[family=Dialog,name=Dialog,style=plain,size=12]
    Apparently, I need to use the correct "name" to specify the font. So my next try was this:
    $ xlsfonts -ll -fn -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1
    name: -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1
    direction: left to right
    indexing: matrix
    rows: 0x00 thru 0x30 (0 thru 48)
    columns: 0x00 thru 0xff (0 thru 255)
    all chars exist: no
    default char: 0x0000 (0)
    ascent: 14
    descent: 4
    font type: Character Cell
    bounds: width left right asc desc attr keysym
    min 9 0 0 -3 -13 0x0000
    max 9 8 9 14 4 0x0000
    properties: 23
    FONTNAME_REGISTRY
    FOUNDRY Misc
    FAMILY_NAME Fixed
    WEIGHT_NAME Medium
    SLANT R
    SETWIDTH_NAME Normal
    ADD_STYLE_NAME
    PIXEL_SIZE 18
    POINT_SIZE 120
    RESOLUTION_X 100
    RESOLUTION_Y 100
    SPACING C
    AVERAGE_WIDTH 90
    CHARSET_REGISTRY ISO10646
    CHARSET_ENCODING 1
    COPYRIGHT Public domain font. Share and enjoy.
    XMBDFEDINFO 654
    CAP_HEIGHT 10
    X_HEIGHT 7
    FONT -Misc-Fixed-Medium-R-Normal--18-120-100-100-C-90-ISO10646-1
    WEIGHT 10
    RESOLUTION 138
    QUAD_WIDTH 9
    name: -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1
    direction: left to right
    indexing: matrix
    rows: 0x00 thru 0x30 (0 thru 48)
    columns: 0x00 thru 0xff (0 thru 255)
    all chars exist: no
    default char: 0x0000 (0)
    ascent: 14
    descent: 4
    font type: Character Cell
    bounds: width left right asc desc attr keysym
    min 9 0 0 -3 -13 0x0000
    max 9 8 9 14 4 0x0000
    properties: 23
    FONTNAME_REGISTRY
    FOUNDRY Misc
    FAMILY_NAME Fixed
    WEIGHT_NAME Medium
    SLANT R
    SETWIDTH_NAME Normal
    ADD_STYLE_NAME
    PIXEL_SIZE 18
    POINT_SIZE 120
    RESOLUTION_X 100
    RESOLUTION_Y 100
    SPACING C
    AVERAGE_WIDTH 90
    CHARSET_REGISTRY ISO10646
    CHARSET_ENCODING 1
    COPYRIGHT Public domain font. Share and enjoy.
    XMBDFEDINFO 654
    CAP_HEIGHT 10
    X_HEIGHT 7
    FONT -Misc-Fixed-Medium-R-Normal--18-120-100-100-C-90-ISO10646-1
    WEIGHT 10
    RESOLUTION 138
    QUAD_WIDTH 9
    (Yes, xlsfonts prints two entries.)
    Here is a bit more data:
    [pjungwir@mccurdy unicode_gui]$ uname -a
    Linux mccurdy.nfic.com 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686 i686 i386 GNU/Linux
    [pjungwir@mccurdy unicode_gui]$ cat /etc/redhat-release
    Red Hat Linux release 8.0 (Psyche)
    [pjungwir@mccurdy unicode_gui]$ java -version
    java version "1.4.2_01"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_01-b06)
    Java HotSpot(TM) Client VM (build 1.4.2_01-b06, mixed mode)
    If anyone has any suggestions, I would really appreciate it. I'd like to find an answer that doesn't involve editing the font.properties file.
    Thanks,
    --Paul

    Hi Sojan,
    first up, forget the notion of even tinkering with the font.properties file if you can. It's an old, outdated method of setting up the fonts that Sun doesn't even support any more. Use setFont() where you can, and die trying in the process! ;-)
    One thing I would check is which font each AWT component currently thinks it has. It's easy enough to set the font system wide with Swing components, but I'm not sure if that capability extends to AWT components (I've certainly had trouble with it in various places in the past). While you've set up the Chinese font correctly, your AWT components might still be stuck with the Java default (Helvetica, or whatever it is, which is incapable of displaying Chinese), and hence displaying the rectangles because they don't know how to handle the foreign characters. You might need to set SimSun as the font for each of your AWT components individually at a worst-case scenario.
    Hope that helps,
    Martin Hughes

  • In 6.0 get error "END_OF_RECORD" must be a character-type data object .....

    Hi All,
    following piece of code was working fine in 4.6 C   but in ECC 6.0 I get the following error:
    "   "END_OF_RECORD" must be a character-type data object (data type C, N,D, T or STRING) .  " 
    I tried type-casting with field symbols but still not able to remove the error.  Cannot convert end_of_record directly to type C as it may hamper the functionality. Plz advice how to remove the error without converting type x to type C
    In the following code :
    DATA:  DELIMITER   TYPE C VALUE   CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
            end_of_record             TYPE x.
    SPLIT data_file_i AT delimiter INTO it_ekko-rtype
                                              it_ekko-ebeln
                                              it_ekko-bsart
                                              it_ekko-lifnr
                                              it_ekko-bedat
                                              it_ekko-ekorg
                                              it_ekko-ekgrp
                                              it_ekko-bukrs
                                              it_ekko-zterm
                                              it_ekko-zbd1t
                                              it_ekko-zbd1p
                                              it_ekko-zbd2t
                                              it_ekko-zbd2p
                                              it_ekko-zbd3t
                                              it_ekko-inco1
                                              it_ekko-inco2
                                              it_ekko-waers
                                              it_ekko-wkurs
                                              it_ekko-kufix
                                              it_ekko-verkf
                                              it_ekko-telf1
                                              it_ekko-ihrez
                                              it_ekko-unsez
                                              it_ekko-angnr
                                              it_ekko-ihran
                                              it_ekko-submi
                                              it_ekko-loekz
                                              end_of_record.
    where all these fields except  " end_of_record " are of character type and  "data_file_i " is a character type structure as defined below:
    DATA :
      BEGIN OF data_file_i OCCURS 0,
        record(1000),
      END OF data_file_i,

    Type X is not allowed in Unicode. When a field is declared as Type X with Value u201809u2019 or any other value, it can be resolved by using classes.
    Before Unicode
                      CONSTANTS: c_hex TYPE x VALUE '09'.
    Resolution:
    Itu2019s work for any value of x.
    First a temporary field of Type c should declare. Following class will convert Type x variable into type c.
    Example:
    CONSTANTS: c_hex TYPE x VALUE '09'.
    DATA: LV_TEMP TYPE STRING.
    DATA: LV_TMP TYPE C.
    TRY.
    CALL METHOD CL_ABAP_CONV_IN_CE=>UCCP
    EXPORTING
    UCCP   = c_hex
    RECEIVING
    CHAR   = LV_TMP   .
    CATCH CX_SY_CONVERSION_CODEPAGE.
    CATCH CX_PARAMETER_INVALID_TYPE.
    CATCH CX_SY_CODEPAGE_CONVERTER_INIT.
    ENDTRY.
    CONCATENATE I_OUTPUT-BKTXT I_OUTPUT-BVORG            
    I_OUTPUT-BUDAT I_OUTPUT-MESSAGE INTO
    SEPARATED BY LV_TMP.                      
    I_BUFFER = LV_TEMP.
    CLEAR LV_TEMP.
    CLEAR LV_TMP.
    OR
    Note: It works only for type x value  09.
    CLASS cl_abap_char_utilities DEFINITION LOAD.
    CONSTANTS: c_hex TYPE c VALUE
                             abap_char_utilities=>HORIZONTAL_TAB.

  • Displaying Unicode in Sweden

    Hi,
    I'm trying to get a JTextPane to display Unicode (e.g. Chinese) characters. I'm situated in Sweden so my cup of Java (or something) doesn't seem too happy about it ;).
    More specifically, I want to paste a, say, Chinese character into a JTextPane and have it displayed as one and not as a square. Then I want to send it to another JTextPane and have it displayed there.
    I've looked at the String and the character is properly encoded there. I've tried to exchange the font.properties file with font.properties.zh_TW but to no good. I've also tried to edit the font.properties file, using the Arial Unicode MS font (which is pre installed on my Windows 2000 OS) and the SYMBOL_CHARSET (instead of simple Arial and ANSI_CHARSET), but that haven't helped me either.
    Thanks for any help you can offer,
    Pelle

    The remedy may depend on whether the problem is specific to JTextPane or to any other TextComponent's. Does the method setText(String) work?

Maybe you are looking for