• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Unicode trouble
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unicode trouble


  • Subject: Re: Unicode trouble
  • From: Kushnir Gennady <email@hidden>
  • Date: Thu, 18 Aug 2005 21:44:51 +0400

Hello
My site is working good with Cyrillic

I add this to Application:

        public void appendToResponse(WOResponse response, WOContext wocontext) {
            super.appendToResponse(response, wocontext);
            if (_NSUtilities.UTF8StringEncoding.equals(response.contentEncoding()))
                response.setHeader("text/html; charset=UTF-8","Content-Type");
        }

        public WOResponse createResponseInContext(WOContext wocontext) {
            WOResponse woresponse = super.createResponseInContext(wocontext);
            woresponse.setContentEncoding(_NSUtilities.UTF8StringEncoding);
            return woresponse;
        }

This to session (I assume, something like this may be added to Application instead):
  

    public void takeValuesFromRequest(WORequest aRequest, WOContext aContext)  {
        aRequest.setDefaultFormValueEncoding(_NSUtilities.UTF8StringEncoding);
        super.takeValuesFromRequest(aRequest, aContext);
    }


And if you use DirectActions but not componentActions you have to add this to DirectActions:

        public WOActionResults performActionNamed(String anActionName) {
                WOResponse result = super.performActionNamed(anActionName).generateResponse();
                if (_NSUtilities.UTF8StringEncoding.equals(result.contentEncoding()))
                    result.setHeader("text/html; charset=UTF-8","Content-Type");
                return result;
                }

Also today I realized that I had to add "unicode=true&characterEncoding=UTF-8" to jdbc connect string though I wrote it is not necessary previously.
By the way. Are you using correct jdbc adaptor?

Consider reading
http://homepage.mac.com/kelleherk/iblog/C711669388/E70925289/index.html

Regards
Gennady

On 18.08.2005, at 21:02, Jim Kuo wrote:

Hi,

Have you ever managed to get cyrillic to display in your site when you have UTF-8 characters in both database and the .wo files ?

I tried your solution, however the problem remains, if i omit the line

aResponse.setContentEncoding(_NSUtilities.UTF8StringEncoding);

from appendToResponse(), then the UTF-8 characters in the database get inserted and retrieved properly, but the UTF-8 characters embedded in the .wo files would appear as ???.

If i include the setContentEncoding line, then it appears if WO is trying to encode the existing UTF-8 data again, so this time the UTF-8 characters in the .wo files appear fine, but the data from the database appears as rubbish.

Jim

On 18 Aug 2005, at 09:57, Kushnir Gennady wrote:

the problem is with database encoding.
consider reading thread "ConnectorJ and MySQL4.1"
here is my solution posted there.
there were others

Begin forwarded message:

From: Kushnir Gennady <email@hidden>
Date: 10.08.2005
To: Dev WO <email@hidden>
Cc: WebObjects Development <email@hidden>
Subject: Re: ConnectorJ and MySQL4.1 (my solution)


I solved the problem just setting database character set to utf 8.
it works fine with cyrillic even with connector 3.1.10 and without "unicode=true&characterEncoding=UTF-8".
I'm happy :)

http://dev.mysql.com/doc/mysql/en/charset-database.html

Gennady
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Unicode trouble
      • From: Jim Kuo <email@hidden>
References: 
 >[Newbie] -> how to reference static files (css, images, etc)? (From: Miguel Arroz <email@hidden>)
 >Re: [Newbie] -> how to reference static files (css, images, etc)? (From: John Bruce <email@hidden>)
 >Unicode trouble (From: Jim Kuo <email@hidden>)
 >Re: Unicode trouble (From: Kushnir Gennady <email@hidden>)
 >Re: Unicode trouble (From: Jim Kuo <email@hidden>)

  • Prev by Date: Re: Unicode trouble
  • Next by Date: Re: [Newbie] -> how to reference static files (css, images, etc)?
  • Previous by thread: Re: Unicode trouble
  • Next by thread: Re: Unicode trouble
  • Index(es):
    • Date
    • Thread