• 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: WOResourceManager and localization issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WOResourceManager and localization issue


  • Subject: Re: WOResourceManager and localization issue
  • From: Chuck Hill <email@hidden>
  • Date: Thu, 8 Dec 2005 15:40:28 -0800

Just because you read it in my book, does not mean it is 100% correct. I am an English speaker in an English speaking area, so my experience with this is limited. Jean-François is correct, it is trying to guess and guessing wrong. His UTF-16 method is one solution. Another is to use NSBundle or WOResourceManager to re- implement this broken functionality. Something like this:

String html = new String(NSBundle.mainBundle().bytesForResourcePath(
    ((Session) session()).siteLanguage() +
        ".lproj/" + nameWithoutPath() + ".wo/" +
        nameWithoutPath() + ".html"),
   "UTF-8");

The problem with UTF-16 (in my very, very limited experience) is that may editors don't display it correctly.

Chuck


public static String portugueseLanguageName() {
return Application.application().resourceManager ().stringForKey(Session.PORTUGUESE_LANGUAGE_KEY,
Application.RESOURCES_DEFAULT_TABLE_NAME,
"PT",
null,
new NSArray(new Object[] {"Portuguese"}));





On Dec 8, 2005, at 11:23 AM, Jean-François Veillette wrote:

WOResourceManager try to 'guess' the encoding of the file.
For all 8bits encoding, it cannot guess it and revert to ISO-Latin1.
The only way for WOResourceManager to guess it properly is to use UTF-16.


- jfv


Le 05-12-08, à 14:15, Miguel Arroz a écrit :

Hi!

I'm reading a string from a .strings file that contains accentuated characters. The code is the following:

public static String portugueseLanguageName() {
return Application.application().resourceManager ().stringForKey(Session.PORTUGUESE_LANGUAGE_KEY,
Application.RESOURCES_DEFAULT_TABLE_NAME,
"PT",
null,
new NSArray(new Object[] {"Portuguese"}));
}


The file is in XML format and was created with Property List Editor. Any attempt to create the file using a normal text editor results in parsing error at the first character. Even opening and saving the file without modifications in TextWrangler originates an error (anyone knows why?).

Well, but my problem is far more serious. I'm using that string to fill one of the items of a pop up menu on a page. I have followed all the UTF-8 related precautions, overloadings, etc, explained on Chuck's book. Still, instead of Português, I get some strange characters (like russian or greek) instead of the accentuated ê.

I try to write some accentuated text on a component, and save it has UTF-8. WebObjects builder 5.3.1 appears to always save those characters using escape characters, like &eacute; instead of é. Nevertheless, I edited the .woo file to set the right encoding, and editied the .html file in TextWrangler, restoring the real accentuated characters. It works! That appear on the browser as they should. The only problem is the pop-up menu made with strings that come from a .strings file, so my guess is that the problem is related to the file reading/decoding.

I find this strange, as the .strings method is mentioned on chuck's book, so I guess it should work... what the heck is going on here?

  Yours

Miguel Arroz

"The world lies in the hands of evil
 And we pray it would last" -- Apocalyptica, Life Burns!

Miguel Arroz
http://www.ipragma.com




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


This email sent to email@hidden


http://www.freeiPods.com/?r=21419063

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection aroundhttp:// mail.yahoo.com_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net


This email sent to email@hidden


--
Coming in 2006 - an introduction to web applications using WebObjects and Xcode http://www.global-village.net/wointro


Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/practical_webobjects




_______________________________________________ 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
References: 
 >WOResourceManager and localization issue (From: Miguel Arroz <email@hidden>)
 >Re: WOResourceManager and localization issue (From: Jean-François Veillette <email@hidden>)

  • Prev by Date: Re: Finding the top level component
  • Next by Date: Re: Help deciphering SocketException, (anchor problem)
  • Previous by thread: Re: WOResourceManager and localization issue
  • Next by thread: Help deciphering SocketException, (anchor problem)
  • Index(es):
    • Date
    • Thread