Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4399903

System Clipboard cannot handle Unicode Text

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.3.0
    • client-libs
    • x86
    • windows_98



      Name: boT120536 Date: 12/20/2000


      java version "1.3.0_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_01)
      Java HotSpot(TM) Client VM (build 1.3.0_01, mixed mode)


      In my Latin-1 environment (German), the System Clipboard skips every non Latin-1
      character of the clipboard content, it seems to return Latin-1 characters. Use
      an application capable of making non-Latin characters accessible by the
      clipboard to test this:

      /* ClipboardTest.java
      */

      package com.mn.tools.test.bugs.java;

      import java.io.IOException;
      import java.awt.*;
      import java.awt.datatransfer.*;

      /**
      This class should show that the Java Clipboard JDK1.3.0_01 on Windows9 8 SE is
      not able to transfer
      (at least some) Unicode characters.

      System:
      - Windows98 SE (German)
      - C:\>java -version
      java version "1.3.0_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_01)
      Java HotSpot(TM) Client VM (build 1.3.0_01, mixed mode)
      - Note that the used JDK is not a Japanese or Chinese release

      How to reproduce:
      - Use a current Mozilla Browser or Mozilla 0.6

      - Testcase 1
      - Go to http://chinese.china.com/zh_tw/
      - Select some chars
      - Copy them
      - Run this program
      -> This program will see an empty String
      - Testcase 2
      - Go to http://www.ru/index_r.htm
      - Select some text, for example this text where you can find
      "Arts and Culture" in the English version of that page ( http://www.ru/ )
      - Run this program
      -> This program will just see the spaces of the selected text, not the other
      characters selected.
      - Mozilla 0.6 and Netscape Communicator 4.7 do not work together while
      Mozilla 0.6 and Internet Explorer 5 do. This proves that the problem is not on the
      Mozilla side.



      @author Xu?n Baldauf <###@###.###>
      */
      public class ClipboardTest {

      public static void main(String argv[]) {
      try {
      Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
      Transferable transferable = cb.getContents(null);
      Object o = transferable.getTransferData(DataFlavor.stringFlavor);

      System.out.println("Your clipboard content is \""+o+"\"");
      } catch (UnsupportedFlavorException e) {
      System.err.print("caught: ");
      e.printStackTrace();
      } catch (IOException e) {
      System.err.print("caught: ");
      e.printStackTrace();
      } finally {
      // Bug: AWT does not exist itself when it's not needed anymore.
      System.exit(0);
      }
      }
      }
      (Review ID: 114002)
      ======================================================================

            dmendenhsunw David Mendenhall (Inactive)
            bonealsunw Bret O'neal (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: