I could not find a good recipe for inserting Arabic entered on a GWT
page into a text field to be inserted into MySQL as anything other
than "?????????". Here is a simplified example



CLIENT:

        private RichTextArea arabicNameField = new RichTextArea();
        //First thing we discovered is this only reliably works in a
RichTextArea, a TextBox does not seem to work for arabic

        myService.insertText(arabicName, new AsyncCallback<Void>() {
                        public void onFailure(Throwable caught) {
                                System.out.println(caught.getMessage());
                        }

                        // we don't do anything here for saving
                        public void onSuccess(Void result) {
                                return;
                        }
                });



SERVER:
                //The Key is in the UTF encoding and getting the bytes rather 
than
the text
                String queryString = "insert into names (arabicname) values 
(?)";

                mySqlStatement = con.prepareStatement(queryString);

                try {
                        mySqlStatement.setBytes(1, 
arabicName.getBytes("UTF-8"));
                } catch (UnsupportedEncodingException e) {
                        mySqlStatement.setString(1, "Unable to Encode Name");
                }

                mySqlStatement.executeUpdate();
                mySqlStatement.close();
                con.close();

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to