You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by an...@magnasteyr.com on 2005/11/24 11:19:23 UTC

AW: AW: German Umlauts with InputSuggestAjax

Hi Volker!

I have tried your suggestion with UnicodeEncoder but it didn't work.
Do you mean it like that?

if (fname.startsWith(upperCasePrefix)) {
					
UnicodeEncoder.encode(fname);
li.add(fname);
}

Regards
Andy

-----Ursprüngliche Nachricht-----
Von: Volker Weber [mailto:users.myfaces@weber-oldenburg.de]
Gesendet: Donnerstag, 24. November 2005 11:09
An: MyFaces Discussion
Betreff: Re: AW: German Umlauts with InputSuggestAjax, Stylesheets and
Speed of Code with InputSuggestAjax


Hi Andy,

andreas.mitter@magnasteyr.com wrote:
> Hi Volker!
> 
> I have achieved to solve the problems with the Stylesheet. I have set a styleLocation Attribute and 
> implemented my own theme.css
> 
> 
> But I still have problems with the umlauts!
> I need it very fast, that's why I want to solve it.
> How do you mean I can encoded them before adding them to the list. Do i have to look at each word if it contains an Umlaut and then encode this single character?

You can use UnicodeEncoder.encode(str) on all strings before adding to
the list, this is what the myfaces ResponsWriterImpl does.

Regards

  Volker
> 
> Regards
> Andy
> 
> 
> PS: JIRA is openend. 
> 
> -----Ursprüngliche Nachricht-----
> Von: Volker Weber [mailto:users.myfaces@weber-oldenburg.de]
> Gesendet: Donnerstag, 24. November 2005 10:29
> An: MyFaces Discussion
> Betreff: Re: German Umlauts with InputSuggestAjax, Stylesheets and Speed
> of Code with InputSuggestAjax
> 
> 
> Hi,
> 
> andreas.mitter@magnasteyr.com wrote:
> 
>>That's for answering..
>>
>>1)Problems with german Umlauts
>>Is there a possibility to encode the response before its send?
>>How can I do that?
> 
> 
> If you need this fast, you can encode the values in your bean before
> adding them to the list. but this will make problems if the bug is fixed
> because encoding twice results in displaying e.g. 'ä' inside the
> browsers window.
> 
> I also need to fix this for tobago so i will go to provide a patch, but
> this could take one or two weeks.
> 
> please create a jira issue for this.
> 
> 
>>2)Stylesheets:
>>Can you give me a hint, where I can set them. Do I have to set it in the InputSuggestAjaxRenderer?
>>
> 
> 
> you can edit the file
> sandbox/src/java/org/apache/myfaces/custom/inputsuggestajax/resource/default/theme.css
> 
> or maybe overwrite these definitions ?
> Is it possible to overwrite myfaces styles ?
> 
> 
> Regards,
> 
>   volker
> 
> 
>>Regards
>>Andy
>>
>>-----Ursprüngliche Nachricht-----
>>Von: Volker Weber [mailto:users.myfaces@weber-oldenburg.de]
>>Gesendet: Mittwoch, 23. November 2005 15:47
>>An: MyFaces Discussion
>>Betreff: Re: {Filename?} German Umlauts with InputSuggestAjax,
>>Stylesheets and Speed of Code with InputSuggestAjax
>>
>>
>>Hi Andy,
>>
>>
>>
>>andreas.mitter@magnasteyr.com wrote:
>>
>>
>>>Hi all!
>>>
>>>I have now achieved that the InputSuggestAjax Component works, but I
>>>have still three questions and I would be terribly grateful, if somebody
>>>could answer me:
>>>
>>>1) How can I add stylesheet attributes for the List and the Inputfield.
>>>I have already tried to add a styleClass attribute, but it doesn't work
>>>like I want it.
>>
>>
>>No idea, i think this is not supported yet. Martin?
>>
>>
>>
>>>2) I have Problems with German Umlauts like äöü .. They are display with
>>>a ? in the List... How can I change this? Is this done per purpose or is
>>>this a bug?
>>
>>
>>This is a bug i think, the response is not specialy encoded before send.
>>
>>
>>
>>>ole0.bmp
>>>
>>>
>>>3) My code works, but I'm afraid that it will be too slow, if the list
>>>contains too much records. Perhaps some of you can tell me, if there
>>>could be problems with my code and what I can do better
>>>
>>>(I get the List of Fnames from an Hibernate Query)
>>>
>>>       public List getItems(String prefix, Integer maxSize) {
>>>
>>>               qh = (QueryHelper) FacesUtil.getManagedBean("queryHelper");
>>>               Iterator it = qh.getFnames().iterator();
>>>
>>>               List li = new ArrayList();
>>>
>>>               try {
>>>                       while (it.hasNext()) {
>>>
>>>                               EtCompany company = (EtCompany) it.next();
>>>
>>>                               String fname =
>>>company.getCompany().toUpperCase();
>>>                                                      
>>>                               if
>>>(fname.startsWith(prefix.toUpperCase())) {
>>>                                       if(li.size()<maxSize.intValue())
>>>                                       {
>>>                                       li.add(fname);
>>>                                       }
>>>                               }
>>>
>>>                       }
>>>               }
>>>               catch (Exception e) {
>>>                       e.printStackTrace();
>>>               }
>>>               return li;
>>>       }
>>>
>>
>>
>>1. get the prefix.toUpperCase() out of the loop.
>>2. break the loop if maxSize is reached, don't continue looping without
>>any adding to result list:
>>
>>  int max = maxSize.intValue() - 1;
>>  String upperCasePrefix = prefix.toUpperCase();
>>
>>  while (it.hasNext()) {
>>    if (li.size() > max) {
>>      break;
>>    }
>>    EtCompany company = (EtCompany) it.next();
>>    String fname = company.getCompany().toUpperCase();
>>
>>    if (fname.startsWith(upperCasePrefix)) {
>>      li.add(fname);
>>    }
>>  }
>>
>>Regards,
>>
>>  Volker
>>
>>
>>
>>
>>
>>>Regards
>>>Andy
>>>
> 
> 

-- 
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.


______________________________________________________________________

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
your system manager.
 
This footnote also confirms that this email message has been swept
for the presence of computer viruses. 
______________________________________________________________________

Re: AW: AW: German Umlauts with InputSuggestAjax

Posted by Volker Weber <us...@weber-oldenburg.de>.
Hi,

UnicodeEncoder returns the encoded string.

andreas.mitter@magnasteyr.com wrote:
> Hi Volker!
> 
> I have tried your suggestion with UnicodeEncoder but it didn't work.
> Do you mean it like that?
> 
> if (fname.startsWith(upperCasePrefix)) {
> 					
> UnicodeEncoder.encode(fname);
> li.add(fname);

  li.add(UnicodeEncoder.encode(fname));

> }
> 
> Regards
> Andy
> 

regards
  Volker

-- 
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.