Problems reading unicode characters with BufferedReader or PrintWriter

I am creating a pretty standard chat server and client with the exception that I want to be able to send special math symbols back and forth to aid in helping people with math homework. The unicode characters will appear on the buttons, in the textField (where users type in their messages), in the messageArea (where users see all of the messages) correctly. However, as soon as the server reads it, it is converted to a ? character by either the BufferedReader or the PrintWriter, but I am fairly certain it is the BufferedReader. All of the Sun examples I have read recommend doing exactly what I have done to be able to support unicode characters so I am somewhat at a loss. Any help would be appreciated. I will include all of the source code (which is rather large) but the main problem is the with the BufferedReader or PrintWriter when the servers reads the string in and then broadcasts it to all the clients (at least I'm pretty sure it is).
// ChatServer.java
import java.net.Socket;
import java.net.ServerSocket;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.Set;
import java.util.HashSet;
import java.util.HashMap;
import java.util.Iterator;
* A multithreaded chat room server. When a client connects the
* server requests a screen name by sending the client the
* text "SUBMITNAME", and keeps requesting a name until
* a unique one is received. After a client submits a unique
* name, the server acknowledges with "NAMEACCEPTED". Then
* all messages from that client will be broadcast to all other
* clients that have submitted a unique screen name. The
* broadcast messages are prefixed with "MESSAGE ".
* Because this is just a teaching example to illustrate a simple
* chat server, there are a few features that have been left out.
* Two are very useful and belong in production code:
* 1. The protocol should be enhanced so that the client can
* send clean disconnect messages to the server.
* 2. The server should do some logging.
public class ChatServer {
* The port that the server listens on.
private static final int PORT = 9001;
* The set of all names of clients in the chat room. Maintained
* so that we can check that new clients are not registering name
* already in use.
private static HashSet names = new HashSet();
* The set of all the print writers for all the clients. This
* set is kept so we can easily broadcast messages.
private static HashMap writers = new HashMap();
private static HashMap userSockets = new HashMap();
private static Set keys;
* The appplication main method, which just listens on a port and
* spawns handler threads.
public static void main(String[] args) throws Exception {
System.out.println("The chat server is running.");
ServerSocket listener = new ServerSocket(PORT);
try {
while (true) {
new Handler(listener.accept()).start();
     } catch (Exception e) {
} finally {
listener.close();
* A handler thread class. Handlers are spawned from the listening
* loop and are responsible for a dealing with a single client
* and broadcasting its messages.
private static class Handler extends Thread {
private String name;
private Socket socket;
private BufferedReader in;
private PrintWriter out;
* Constructs a handler thread, squirreling away the socket.
* All the interesting work is done in the run method.
public Handler(Socket socket) {
this.socket = socket;
public void disconnect(String userName) {
if (userName != null) {
names.remove(userName);
if (writers.get(userName) != null) {
writers.remove(userName);
try {
((Socket)userSockets.get(userName)).close();
} catch (IOException e) {
e.printStackTrace();
System.out.println(userName +" has disconnected from the Chat Server.");
keys = writers.keySet();
for (Iterator i = keys.iterator(); i.hasNext(); ) {
((PrintWriter)writers.get(i.next())).println(
"USERQUIT" +name);
public void disconnectAll() {
for (Iterator i = names.iterator(); i.hasNext();) {
String userName = i.next().toString();
if (!userName.equals("administrator")) {
names.remove(userName);
keys = writers.keySet();
for (Iterator it = keys.iterator(); it.hasNext(); ) {
((PrintWriter)writers.get(it.next())).println(
"USERQUIT" +name);
writers.remove(userName);
userSockets.remove(userName);
* Services this thread's client by repeatedly requesting a
* screen name until a unique one has been submitted, then
* acknowledges the name and registers the output stream for
* the client in a global set, then repeatedly gets inputs and
* broadcasts them.
public void run() {
try {
// Create character streams for the socket.
in = new BufferedReader(new InputStreamReader(
socket.getInputStream()));
out = new PrintWriter(socket.getOutputStream(), true);
// Request a name from this client. Keep requesting until
// a name is submitted that is not already used. Note that
// checking for the existence of a name and adding the name
// must be done while locking the set of names.
while (true) {
out.println("SUBMITNAME");
name = in.readLine();
if (name == null) {
return;
synchronized (names) {
if (!names.contains(name) && name.equalsIgnoreCase("administrator")) {
out.println("SUBMITPASSWORD");
String password = in.readLine();
if (password.equals("s3cure")) {
out.println("GRANTEDADMIN");
if (!names.contains(name)) {
names.add(name);
break;
// Now that a successful name has been chosen, add the
// socket's print writer to the set of all writers so
// this client can receive broadcast messages.
out.println("NAMEACCEPTED");
keys = writers.keySet();
for (Iterator i = keys.iterator(); i.hasNext(); ) {
((PrintWriter)writers.get(i.next())).println(
"USERJOIN" +name);
writers.put(name, out);
userSockets.put(name, socket);
System.out.println(name +" has successfully connected to the Chat Server.");
// Accept messages from this client and broadcast them.
// Ignore other clients that cannot be broadcasted to.
while (true) {
String input = in.readLine();
if (input == null) {
return;
          else if (input.startsWith("LISTUSERS")) {
               Iterator i = names.iterator();
               String namesString = new String();
               while (i.hasNext()) {
               namesString += " " +i.next();
               out.println("USERLIST " +namesString);
     catch (Exception e) {
     finally {
          disconnect(name);
// ChatClient.java
import java.util.HashSet;
import java.util.StringTokenizer;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
import java.awt.event.WindowEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.KeyListener;
import java.awt.event.KeyEvent;
import java.awt.Point;
import java.awt.Button;
import java.awt.Font;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JTextArea;
//import javax.swing.JTextPane;
import javax.swing.JScrollPane;
import javax.swing.JOptionPane;
import javax.swing.JList;
import javax.swing.DefaultListModel;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import java.net.Socket;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.IOException;
* A simple Swing-based client for the chat server. Graphically
* it is a frame with a text field for entering messages and a
* textarea to see the whole dialog.
* The client follows the Chat Protocol which is as follows.
* When the server sends "SUBMITNAME" the client replies with the
* desired screen name. The server will keep sending "SUBMITNAME"
* requests as long as the client submits screen names that are
* already in use. When the server sends a line beginning
* with "NAMEACCEPTED" the client is now allowed to start
* sending the server arbitrary strings to be broadcast to all
* chatters connected to the server. When the server sends a
* line beginning with "MESSAGE " then all characters following
* this string should be displayed in its message area.
public class ChatClient {
BufferedReader in;
PrintWriter out;
JFrame frame = new JFrame("Math Chatter version 0.3");
JTextField textField = new JTextField(40);
JTextArea messageArea = new JTextArea(25, 40);
//JTextPane messageArea = new JTextPane();
// Menu
JMenuBar menuBar = new JMenuBar();
// File Menu and MenuItems
JMenu fileMenu = new JMenu();
JMenuItem connectMenuItem = new JMenuItem();
JMenuItem disconnectMenuItem = new JMenuItem();
JMenuItem exitMenuItem = new JMenuItem();
// Help Menu and MenuItems
JMenu helpMenu = new JMenu();
JMenuItem aboutMenuItem = new JMenuItem();
JOptionPane aboutDialog = new JOptionPane();
// Message Area Popup Menu and MenuItems
JPopupMenu messageAreaPopupMenu = new JPopupMenu();
JMenuItem connectPopupMenuItem = new JMenuItem();
JMenuItem disconnectPopupMenuItem = new JMenuItem();
JMenuItem clearTextMenuItem = new JMenuItem();
JMenuItem exitPopupMenuItem = new JMenuItem();
MouseListener messageAreaPopupListener = new messageAreaPopupListener();
// User Area Popup Menu and MenuItems
JPopupMenu userAreaPopupMenu = new JPopupMenu();
JMenuItem pingPopupMenuItem = new JMenuItem();
JMenuItem disconnectUserPopupMenuItem = new JMenuItem();
JMenuItem disconnectAllUsersPopupMenuItem = new JMenuItem();
MouseListener userAreaPopupListener = new userAreaPopupListener();
// Panel with textfield, send, and clear buttons
JPanel sendTextPanel = new JPanel();
// Panel that has all the math buttons
JPanel buttonPanel = new JPanel();
// Panel that has messageArea and users panell
JPanel displayPanel = new JPanel();
DefaultListModel listModel = new DefaultListModel();
JList userNamesList = new JList(listModel);
//JTextArea userNamesTextArea = new JTextArea(25, 10);
// buttonPanel stuff
Button sendButton = new Button();
Button clearButton = new Button();
Button infinityButton = new Button();
Button thetaButton = new Button();
Button limitButton = new Button();
Button thereforeButton = new Button();
JLabel buttonLabel = new JLabel("Useful math stuff: ");
HashSet usersHashSet = new HashSet();
LinkedList sentMessageList = new LinkedList();
ListIterator sentMessageIterator;
boolean isAdmin = false;
* Constructs the client by laying out the GUI and registering a
* listener with the textfield so that pressing Return in the
* listener sends the textfield contents to the server. Note
* however that the textfield is initially NOT editable, and
* only becomes editable AFTER the client receives the NAMEACCEPTED
* message from the server.
public ChatClient() {
// -----------------> Layout MenuBar
frame.setJMenuBar(menuBar);
fileMenu.setText("File");
connectMenuItem.setText("Connect");
connectMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
showWhoopsDialog();
/*out.println("CONNECT");
try {
run();
catch (Exception ex) {
ex.printStackTrace();
fileMenu.add(connectMenuItem);
disconnectMenuItem.setText("Disconnect");
disconnectMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
chatDisconnect();
fileMenu.add(disconnectMenuItem);
exitMenuItem.setText("Exit");
exitMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
System.exit(0);
return;
fileMenu.add(exitMenuItem);
menuBar.add(fileMenu);
helpMenu.setText("Help");
aboutMenuItem.setText("About");
aboutMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
aboutDialog.setDoubleBuffered(true);
aboutDialog.showMessageDialog(frame,
"Chat Server and Client were originally written by Ray Toal and were found at \n http://www.technocage.com/~ray/viewsource.jsp?java/networking/ChatServer.java and \n http://www.technocage.com/~ray/viewsource.jsp?java/networking/ChatClient.java. \n\n Math Chatter and all revisions have been done by William Ready.",
"About Math Chatter Server and Client version 0.3",
JOptionPane.INFORMATION_MESSAGE);
helpMenu.add(aboutMenuItem);
menuBar.add(helpMenu);
// -----------> End Menu
// -----------> Popup Menus
// -----------> Message Area Popup Menu
connectPopupMenuItem.setText("Connect");
connectPopupMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
showWhoopsDialog();
disconnectPopupMenuItem.setText("Disconnect");
disconnectPopupMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
chatDisconnect();
clearTextMenuItem.setText("Clear text");
clearTextMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
messageArea.setText("");
exitPopupMenuItem.setText("Exit");
exitPopupMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
System.exit(0);
messageAreaPopupMenu.add(connectPopupMenuItem);
messageAreaPopupMenu.add(disconnectPopupMenuItem);
messageAreaPopupMenu.add(clearTextMenuItem);
messageAreaPopupMenu.add(exitPopupMenuItem);
messageArea.addMouseListener(messageAreaPopupListener);
// -----------> End Message Area Popup Menu
// -----------> User Area Popup Menu
pingPopupMenuItem.setText("Ping User");
pingPopupMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//System.out.println("Yo yo yo");
disconnectUserPopupMenuItem.setText("Disconnect User");
disconnectUserPopupMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (userNamesList.getSelectedValue() != null) {
//System.out.println("Yo yo yo");
out.println("DISCONNECTUSER " +userNamesList.getSelectedValue().toString());
//disconnectUserPopupMenuItem.setEnabled(false);
disconnectUserPopupMenuItem.setVisible(false);
disconnectAllUsersPopupMenuItem.setText("Disconnect All Users");
disconnectUserPopupMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (userNamesList.getSelectedValue() != null) {
//System.out.println("Yo yo yo");
out.println("DISCONNECTALLUSERS");
//disconnectUserPopupMenuItem.setEnabled(false);
disconnectAllUsersPopupMenuItem.setVisible(false);
userAreaPopupMenu.add(pingPopupMenuItem);
userAreaPopupMenu.add(disconnectUserPopupMenuItem);
userAreaPopupMenu.add(disconnectAllUsersPopupMenuItem);
userNamesList.addMouseListener(userAreaPopupListener);
// -----------> End User Area Popup Menu
// -----------> End Popup Menus
// -----------> Layout GUI
textField.setEditable(false);
textField.requestDefaultFocus();
messageArea.setEditable(false);
sendTextPanel.setLayout(new FlowLayout());
sendTextPanel.add(textField);
sendButton.setLabel("Send");
sendButton.setEnabled(false);
sendTextPanel.add(sendButton);
clearButton.setLabel("Clear");
sendTextPanel.add(clearButton);
buttonPanel.setLayout(new FlowLayout());
buttonPanel.add(buttonLabel);
infinityButton.setLabel("\u221e");
buttonPanel.add(infinityButton);
     thetaButton.setLabel("\u03b8");
buttonPanel.add(thetaButton);
limitButton.setLabel("lim");
buttonPanel.add(limitButton);
thereforeButton.setLabel("\u2234");
buttonPanel.add(thereforeButton);
userNamesList.setVisibleRowCount(26);
userNamesList.setFixedCellWidth(110);
JScrollPane nameTextScrollPane = new JScrollPane(userNamesList);
JScrollPane messageAreaScrollPane = new JScrollPane(messageArea);
displayPanel.setLayout(new FlowLayout());
displayPanel.add(messageAreaScrollPane);
displayPanel.add(nameTextScrollPane);
frame.getContentPane().add(sendTextPanel, "North");
frame.getContentPane().add(displayPanel, "Center");
frame.getContentPane().add(buttonPanel, "South");
frame.pack();
// ---------------> Add Listeners
textField.addKeyListener(new KeyListener() {
public void keyPressed(KeyEvent e){ }
public void keyTyped(KeyEvent e){
if (e.getKeyChar() == KeyEvent.VK_UP) {
if (sentMessageIterator.hasNext()) {
textField.setText((String)sentMessageIterator.next());
if (e.getKeyChar() == KeyEvent.VK_DOWN) {
if (sentMessageIterator.hasPrevious()) {
textField.setText((String)sentMessageIterator.previous());
if (e.getKeyChar() == KeyEvent.VK_ENTER) {
String text = textField.getText();
if (text != null && !(text.equals(""))) {
sentMessageList.addFirst(textField.getText());
sentMessageIterator = sentMessageList.listIterator();
out.println(textField.getText());
textField.setText("");
public void keyReleased(KeyEvent e){}
sendButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
out.println(textField.getText());
textField.setText("");
textField.requestFocus();
clearButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText("");
textField.requestFocus();
infinityButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText(textField.getText() +"\u221e");
textField.requestFocus();
thetaButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText(textField.getText() +"\u03b8");
textField.requestFocus();
limitButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String limit = JOptionPane.showInputDialog(frame,
"Enter the value that the variable approaches. \n If the value is infinity, type in inf. \n (Note: the variable name is irrelevant)",
"Value that variable approaches",
JOptionPane.QUESTION_MESSAGE);
if (limit != null && limit.equalsIgnoreCase("inf"))
textField.setText(textField.getText() +"lim [x->\u221e] ");
else if (limit != null)
textField.setText(textField.getText() +"lim [x->" +limit +"] ");
textField.requestFocus();
thereforeButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText(textField.getText() +"\u2234");
textField.requestFocus();
// -------------> End Listeners
// -------------> End GUI
* Prompt for and return the address of the server.
private String getServerAddress() {
return JOptionPane.showInputDialog(
frame,
"Enter IP Address of the Server:",
"Welcome to the Chatter",
JOptionPane.QUESTION_MESSAGE);
private void showWhoopsDialog() {
JOptionPane.showMessageDialog(frame,
"Unfortunately this feature has not been implemented yet. \n The only way to connect currently is to exit the program \n and start it again",
"Whoops!",
JOptionPane.ERROR_MESSAGE);
private void chatDisconnect() {
messageArea.append("You have disconnected from the Chat Server\n");
textField.setEditable(false);
messageArea.setEnabled(false);
userNamesList.setEnabled(false);
fileMenu.requestFocus();
out.println("DISCONNECT");
* Prompt for and return the desired screen name.
private String getName() {
return JOptionPane.showInputDialog(
frame,
"Choose a screen name:",
"Screen name selection",
JOptionPane.PLAIN_MESSAGE);
private String getPassword() {
return JOptionPane.showInputDialog(
frame,
"Type in your password:",
"Password Input",
JOptionPane.PLAIN_MESSAGE);
* Connects to the server then enters the processing loop.
private void run() throws IOException {
// Make connection and initialize streams
String serverAddress = getServerAddress();
if (serverAddress != null && !(serverAddress.equals(""))) {
Socket socket = new Socket(serverAddress, 9001);
in = new BufferedReader(new InputStreamReader(
socket.getInputStream()));
out = new PrintWriter(socket.getOutputStream(), true);
// Process all messages from server, according to the protocol.
while (true) {
try {
String line = in.readLine();
if (line.startsWith("SUBMITNAME")) {
out.println(getName());
          } else if (line.startsWith("NAMEACCEPTED")) {
textField.setEditable(true);
          out.println("LISTUSERS");
sendButton.setEnabled(true);
//messageArea.setEnabled(true);
} else if (line.startsWith("SUBMITPASSWORD")) {
out.println(getPassword());
} else if (line.startsWith("GRANTEDADMIN")) {
isAdmin = true;
//disconnectUserPopupMenuItem.setEnabled(true);
disconnectUserPopupMenuItem.setVisible(true);
disconnectAllUsersPopupMenuItem.setVisible(true);
} else if (line.startsWith("DISCONNECT")) {
sendButton.setEnabled(false);
return;
} else if (line.startsWith("USERLIST")) {
          StringTokenizer st = new StringTokenizer(line.substring(8), " ");
          while (st.hasMoreTokens()) {
          usersHashSet.add(st.nextToken());
listModel.removeAllElements();
for (Iterator i = usersHashSet.iterator(); i.hasNext(); ) {
          listModel.addElement(i.next());
} else if (line.startsWith("USERJOIN")) {
          String userJoinName = line.substring(8).trim();
          usersHashSet.add(userJoinName);
          listModel.addElement(userJoinName);
} else if (line.startsWith("USERQUIT")) {
          String userQuitName = line.substring(8).trim();
          usersHashSet.remove(userQuitName);
listModel.removeElement(userQuitName);
} else if (line.startsWith("MESSAGE")) {
messageArea.setFont(new Font("Lucida Sans", Font.PLAIN, 12));
messageArea.append(line.substring(8) + "\n");
catch (Exception e) {
//e.printStackTrace();
return;
* Runs the client as an application with a closeable frame.
public static void main(String[] args) throws Exception {
ChatClient client = new ChatClient();
client.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
client.frame.setLocation(200, 100);
client.frame.show();
client.run();
class messageAreaPopupListener extends MouseAdapter {
public void mousePressed(MouseEvent e) {
maybeShowPopup(e);
public void mouseReleased(MouseEvent e) {
maybeShowPopup(e);
private void maybeShowPopup(MouseEvent e) {
if (e.isPopupTrigger()) {
messageAreaPopupMenu.show(e.getComponent(),
e.getX(), e.getY());
class userAreaPopupListener extends MouseAdapter {
public void mousePressed(MouseEvent e) {
maybeShowPopup(e);
public void mouseReleased(MouseEvent e) {
maybeShowPopup(e);
private void maybeShowPopup(MouseEvent e) {
if (e.isPopupTrigger()) {
userAreaPopupMenu.show(e.getComponent(),
e.getX(), e.getY());

Yes, the code is large, isn't it. It is a good idea, when you have a problem you can't solve, to remove unnecessary code. When the problem disappears, then you know the code you just removed was probably the source of the problem.
But in your case, I think that none of the 1000 lines of code you posted are the problem. You appear to be using Lucida Sans, which is a positive sign; it can render many of the characters you have hard-coded in your program. But apparently the problem is with characters that are coming from somewhere else? And you are using a PrintWriter to send them there and a BufferedReader to get them back? These convert your data from characters to bytes and back again using the default encoding for your system. Chances are that this encoding is some "extended ASCII" encoding that doesn't know how to map anything above \u00ff. You need to get an InputStreamReader and an OutputStreamWriter into your transmission. (Wrap your socket.getInputStream() in an InputStreamReader and wrap that in a BufferedReader, etc.) These objects can take an encoding name as their second parameter; try "UTF-8" or "UTF8" for the encoding. Their API documentation has a link to a page about encodings; follow that if you need more info.

Similar Messages

  • How to use Unicode characters with TestStand?

    I'm trying to implement the use of Greek characters such as mu and omega for units. I enabled multi-byte support in the station options and attempted to paste some characters in. I was able to paste the mu character (μ) and import it from Excel with PropertyLoader. However, I have not had any luck with omega (Ω). I found the HTML codes for these characters on a web page (http://www.hclrss.demon.co.uk/unicode/) so I could use those codes for HTML reports, but that won't work for database logging, nor does it display the characters correctly for the operator interface. The operator interface is not a major problem, but the database must have the correct characters for customer reports. Anyone know how to do this? D
    oes database logging support Unicode for stored procedure calls to Oracle?

    Hello Mark -
    At this time TestStand has no unicode support. The multi-byte support that we do offer is based on the Windows architecture that handles Asian language fonts. It really isn't meant to provide a bridge for unicode values in TestStand. Certainly, your Operator Interface environment will have its own support level for unicode, i.e. at this time neither LabWindows/CVI version 6.0 nor LabVIEW 6.1 officially support unicode characters. This is why you will see that the units defined in the TestStand enumerators are all text-based values.
    I have run a quick test here, probably similar to what you were doing on your end, and I am uncertain if you will get the database behavior you want from TestStand. The database logging steps and API all use basic char sty
    le strings to communicate to the driver. Even though you are reading in a good value from Excel, TestStand is interpreting the character as the nearest ASCII equivalent, i.e. "Ω" will be stored and sent to the database as "O". If you have a stored proceedure in Oracle that is calling on some TestStand variable or property string as an input, then it is doubtful you will get correct transmission of the values to the database. If your stored proceedure could call into a spreadsheet directly, you would probably have better luck.
    Regards,
    Elaine R.
    National Instruments
    http://www.ni.com/ask

  • Problem reading csv file with special character

    Hai all,
    i have the following problem reading a csv file.
    442050-Operations Tilburg algemeen     Huis in  t Veld, EAM (Lisette)     Gebruikersaccount     461041     Peildatum: 4-5-2010     AA461041                    1     85,92
    when reading this line with FM GUI_UPLOAD this line is split up in two lines in data_tab of the FM,
    it is split up at this character 
    Line 1
    442050-Operations Tilburg algemeen     Huis in
    Line 2
    t Veld, EAM (Lisette)     Gebruikersaccount     461041     Peildatum: 4-5-2010     AA461041                    1     85,92
    Anyone have a idea how to get this in one line in my interbal table??
    Greetz Richard

    Hi Greetz Richard
      Problably character  contains same binary code as line feed + carriage return.
      You can use statement below as workaround.
    OPEN DATASET file FOR INPUT IN TEXT MODE ENCODING UNICODE
    In this case your system must support Unicode encoding
    Kind regards

  • Unicode characters with accents won't display in Java Swing applications

    I'm using FreeMind (a Java Swing application) and I need to enter classical Greek characters with accent marks. When I type an accented Greek character, FreeMind displays the unaccented character. However, I can type the accented character in MS Word, then copy and paste into FreeMind, the accented character appears.
    One of the FreeMind developers indicated this was a Java Swing issue, not FreeMind, and suggested I test with another Swing application. So, I installed jEdit and got exactly the same results. I can paste an accented character into jEdit, but I cannot type it in directly.
    I'm using Windows Vista with Java 6 Update 22 (build 1.6.0_22-b04). I also tested on a XP Pro box with Java 1.6.0_18-b07 and got the same result.
    One other note: A couple days ago, I was able to type accented Greek characters into FreeMind. But it only worked for a couple days and then the behavior reverted to unaccented characters. It is possible, but I don't recall specifically, that I updated Java during the time and that may indicate a bug in one version of Java but not another.
    Any assistance or guidance would be greatly appreciated!
    Darin

    Walter,
    The link you provided does not appear to describe the Greek Polytonic keyboard. (The page also describes using the "Option" key as the dead key. There is no "Option" key on my keyboard. I'm using a Sony VGN-NS140E purchased in Chicago, i.e. standard physical US keyboard.)
    Please see http://darindavis.net/languages/keyboard_Greek.pdf for a detailed description of how to use the Greek (Polytonic) keyboard in Windows to produce a complete set of accented classical Greek characters. This method works in MS Word and Notepad. I enabled the Greek (Polytonic) keyboard with:
    Windows (Vista) Start > Control Panel > Regional and Language Options > Change Keyboards > General > Add > Greek (Greece) > Greek Polytonic
    A test that will demonstrate whether you can replicate the error is to do the following in both MS Word (or Notepad) and jEdit (or FreeMind):
    1. Enable the Greek Polytonic keyboard
    2. Type "\" then "e" which should produce an epsilon with smooth breathing and grave accent (ἒ)
    When I do this in MS Word or Notepad, I see the epsilon with smooth breathing and grave accent. When I do this in jEdit and FreeMind, I only see an epsilon.
    I recorded a screencast to illustrate the problem: http://www.screencast.com/t/TRKkKQrCgbN
    Actually, this problem is transient. Sometimes FreeMind or jEdit will display accented characters, other times it won't. Ironically, the first time I recorded the above referenced screencast, a few characters in jEdit did appear with accents. A couple minutes later, I re-recorded the screencast and as you can see jEdit did not display the accents. Between the two recordings I literally did nothing other than stop the Jing recording and start a new one. There is another variable at play here and I can't determine what it is. The most likely source seems to be Java since MS Word and Notepad consistently display accent characters.
    Thanks,
    Darin

  • How to read chinese characters with Nano

    I transfered some chinese songs to my Nano using iTunes.
    But now i can't read the characters...

    Please always tell people what OS you are using.
    Most likely the ID3 tags for the songs are not encoded correctly for the iPod. See this note for some info:
    http://discussions.apple.com/thread.jspa?threadID=121866&tstart=15
    If you are running Windows, there is a program called ConvertZ that may help.

  • Retrieving Unicode characters with MS Query

    Hi.
    I am using MS Query to retrieve data into Excel from an Oracle database.  The data contains several different characters (such as degree and diameter symbols) which are stored as Unicode, but the query returns the same character for all of them.
    In the MS Query window the special characters appear as upside down question marks; in Excel they show as white question marks in a black diamond.  The ASCII code of the character displayed in Excel is '63', and the UNICODE() value is 65533.  This
    isn't the character that is stored in the Oracle database.
    Is there a way to correctly retrieve these characters? 
    The ODBC driver is Oracle in OraClient11g_home1, version 11.02.00.01.  I've tried it with the 'Force SQL_WCHAR Support' setting on, but it didn't make a difference.  So, I've pretty much exhausted my knowledge now...
    Thanks in advance,  Steve

    Hi
    Steve,
    As far as I know the function of MS Query didn’t update anymore after the version of excel 2003. I suppose the issue might be caused by the different rules between Unicode
    and ASCII code, so you get different result in excel from Oracle database. I suggest you can try to use PowerQuery and PowerPivot. Their function are stronger than MS Query, and you can get latest function. Probably they can help you to solve your issue.
    Hope it’s helpful.
    Regards,

  • Problems reading PDF files with i Pad and Mac with 10.8.3 Mountain Lion OS

    I assume InDesign uses the Acrobat XI resources to generate the exported PDFs.
    I have many 1-7 page articles from which I created PDFs via the export function in ID. They all read OK on PC/Apple/Linux based computers.
    I assembled all of the articles into one 50 page document in ID and again exported the large file as a PDF.
    Several of the articles inside the large document now exhibit problems when viewed on an i Pad or a Mac running OS 10.8.3 (Mountain Lion). PC and Linux do not have this problem.
    The problems are, to quote my subscriber: "each paragraph starts with a 'dollar' sign instead of 'Th'. Later the 'Dollar' symbol changes to ' " '. The same thing happens in the Piston Ring article. This doesn't happen on the original PDF files.
    Opening the files in Acrobat Pro XI to look for differences does not discover anything although I assume the problem is somewhere in the font files.
    Any suggestions?

    I've asked the question about the versions and producers of the PDF reader software he is using. I'll be back when that answer comes in.
    I was afraid that Adobe might not use code identical to Acrobat Pro XI to generate PDFs in InDesign. I may have to 'print' to Acrobat and see if that generates a trouble-free PDF.

  • Problem reading Japanese Characters in Servlet

    Hi ,
    Can you Pls. help me with a problem I have with Internationalization.
    My application runs on English version of NT & I'm using SQL 7.0.
    The Application consists of an Applet and I can enter Japanese Text with an IME but when
    I send the same text to the Servlet for inserting into the database ,
    some garbage gets inserted.
    I have tried using Stream Readers with different encodings like SJIS & UTF-8,
    I even tried using the writeUTF method of the DataOutputStream.
    Can you please suggest some solution, or can you give me some site names where I could get
    an answer.
    Waiting for your reply,
    Priya

    Try by converting the string that u r trying to insert like :
    String strToDatabase;
    strToDatabase = new String(strToDatabase.getBytes("8859_1"),"Shift_JIS")

  • Problem loading Cyrillic characters with UTF16

    I am trying to use SQL*Loader to load data into a table that consists of American and Cyrillic columns. The Cyrillic columns are of type NVARCHAR2(300).
    The database NLS params are as follows: NLS_LANGUAGE = AMERICAN, NLS_TERRITORY = AMERICA, NLS_CHARACTERSET =
    WE8ISO8859P1 and NLS_NCHAR_CHARACTERSET = AL16UTF16. The SQL*Loader control file contains the lines:
    CHARACTERSET UTF16
    BYTEORDER BIG
    The data loads but I get question marks in the NVARCHAR2 columns. I tried setting NLS_LANG to AMERICAN_AMERICA.WE8ISO8859P1 and it still loads
    the same way. Do I need to change the NLS_CHARACTERSET to UTF16 as well? What else could I be missing?

    Please check the below. It addresses the same problem as yours:
    http://www.experts-exchange.com/Database/Oracle/10.x/Q_23665329.html

  • Reading unicode files

    I have a problem reading unicode text files.
    As written in books and that stuff i should use Reader instead of InputStream for this purpose. I do so and what i get is letters separated by \u0000 chars. So what is the way to convert unicode to "normal" strings. I deleted all the 00 using StringBuffer, but it don't work in older VMs, such as provided with win98.
    So, what is the way-out?....the second problem going to be is writing unicode files:)

    You have a file encoded using UTF-16, it sounds like. If you use a FileReader, let's say, that object will assume the file you are reading is encoded in your system's default encoding. Unfortunately that default is not going to be UTF-16, but something else like ISO-8859-1. To read a file using an encoding that you specify, do this:Reader r = new InputStreamReader(new FileInputStream(yourFile), "UTF16-BE");This will give you a reader that will probably work... although I don't know if your files are "big-endian" or "little-endian", so you might have to use "UTF16-LE" instead.
    You can wrap that Reader in a BufferedReader if you like, that's generally more efficient for input processing. And to write your data in UTF-16, do the similar thing using an OutputStreamWriter with the same encoding. Check out the API documentation page for the java.io package; the line about InputStreamReader will have a link for either "encoding" or "charset" that will give you more information about UTF-16 and so on.

  • How to display unicode characters

    hi
    How could we save, display, write or read Unicode characters.

    Thanks a lot. I fully understand what you have said.
    My test is running under Traditional Chinese "Big5" Windows XP system.
    Chinese "Big5" font can display on a Console window. I can even input Chinese into the console window.
    Or, in another word, I can TYPE a text file which contains "Big5" Chinese characters and show from the Console window. I assume this will prove that the Console window do know how to handle Chinese characters.
    Now, my test is trying to CONVERT a Unicode string into a Chinese character string expecting the resulting Chinese string can be output into the Console window and let the XP Console window to handle the Chinese character display.
    My main concerned question is "How can I CONVERT a Unicode string into a Big5 Chinese character string?"
    String tstr = new String("\u39321\u28207","big5");
    It seems this statement is INCORRECT, isn't it?

  • Unable to pick unicode characters from input file using "outside in"

    Hi,
    I am using your product "Outside in" to read unicode text from input
    source file. For reading text I am using TReadFirst and TReadNext even
    though "It is not picking unicode characters from input source file
    and also it is giving zunk character to the buffer". How can I
    retrieve unicode character from input source using "outside in"
    product. Your help makes me learn more stuff.
    Regards,
    Naresh.D

    I am trying to use CAReadFirst and CAReadNext to read unicode characters. Even it is not picking, I think is there any flags we need to set. can any one help to this.

  • Problem with reading special characters in unix

    Hi,
    Iam trying to read the data from a file by the following code
    FileInputStream inputFile = new FileInputStream(xx);
    InputStreamReader reader = new InputStreamReader(inputFile);
    BufferedReader bufferedReader = new BufferedReader(reader);
    String s= bufferedReader.readLine();
    one of the line in file has the character �
    It working fine on windows, but on unix Iam getting it as ��.
    I tried with InputStreamReader contructor which accepts the charset name also, like by giving Cp1252, and latin1 etc, but iam not able to get around this problem.
    Any Ideas Please?

    ��This suggests to me that your input file is encoded in UTF-8. But that's only a guess, you need to find out for sure. Asking the person who produced the file would be the most reliable way. When you do find out, specify that encoding as the second parameter of the InputStreamReader constructor.

  • Problems displaying unicode encodeded characters in components

    I'm having problems getting Flash to display unicode that is
    imported from XML. In the example below the unicode characters in
    the name tag come through in Flash exactly as typed eg: \u00EA
    The xml file is written by PHP.
    <?xml version="1.0"?>
    <!-- Generated On: Sep-11-2007 12:24:19
    --><Colortool><Siding><item><type>c</type><id>11</id><name>Rev\u00EAtement
    Sp\u00E9cial</name>
    etc..
    However I've also tried re-saving the file manually in an
    editor encoded as UTF-8. Same result.
    Setting up a little test like:
    temp = "Rev\u00EAtement de premi\u00E8re qualit\u00E9";
    trace ("temp: " + temp);
    Traces: Revêtement de première qualité as
    expected.
    Any ideas why it works when the variable is set in Flash, but
    not when it's loaded from XML?
    Thanks,
    Anson

    By experimenting and some searching through the net I figured out that you need to set the right font. Kannada can be displayed using Tunga font on windows. But neither HTMLEditor nor TextArea has a setFont() method. Instead I tried with Text.
    text.setFont(Font.font("Tunga", 25.0));
    This worked partially. For example, if I try printing the character 'ಲಿ' its two component characters 'ಲ ಿ' are getting printed. They are not joining to form one single character 'ಲಿ'. Kannada like other Indic scripts is a complex layout script and I figured out from this post that complex layouts are not yet supported.
    Re: Urdu language support in Javafx UI Controls
    Unfortunately I cant use javafx for my purpose :-((

  • CRVS2010 Beta - Cannot export report to PDF with unicode characters

    My report has some unicode data (Chinese), it can be previewed properly in the windows form report viewer. However, if I export the report document to PDF file, the unicode characters in exported file are all displayed as a square.
    In the version of Crystal Report 2008 R2, it can export the Chinese characters to PDF when I select a Chinese font in report. But VS2010 beta cannot export the Chinese characters even a Chinese font is selected.

    Barry, what is the specific font you are using?
    The below is a reformatted response from Program Management:
    Using non-Chinese font with Unicode characters (Chinese) the issue is reproducible when using Arial font in Unicode characters field. After changing the Unicode character to Simsun (A Chinese font named 宋体 in report), the problem is solved in Cortez and CR both.
    Ludek

Maybe you are looking for