aspose file tools*
The moose likes Java in General and the fly likes Question about java.text.Normalizer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Question about java.text.Normalizer" Watch "Question about java.text.Normalizer" New topic
Author

Question about java.text.Normalizer

Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
Hello,

I am facing an issue with my java.text.Normalizer which is working fine in one part of the application and not so well in another part of the application.

Here is how I use the Normaliser:


It works well when I use the facelets function from facelets code as shown here:



(I get this: "The+fall", notice the "+" sign.)

However, when I try to use it as follows from java code:



It does not work and I get a space as shown here:

(see: "The fall", notice the space...)

Can anyone please help?

Thanks in advance,

Julien.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13868
    
  10

Julien Martin wrote:

This is an interesting piece of code! It replaces characters with accents etc. with characters without accents. Right? So if you have something like "héllô", it will return "hello". People are sometimes asking for something like this on the forums, this looks like a good solution.

But how did you know about the regular expression "\\p{InCombiningDiacriticalMarks}+"? The character class InCombiningDiacriticalMarks is not documented in the API documentation of class java.util.regex.Pattern.

About your problem:

Sorry, I don't have a direct solution for you. But there are certain URL / HTTP parameter encodings in which spaces are replaced by + signs. Maybe your string that contains the + sign is encoded using such an encoding somewhere else in your program.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
Hello Jesper,
Thanks for your reply.
Yes it looks like the spaces are replaced by "+" signs by the pretty link (see facelets/html code included in my first message).
Do you think I should replace spaces by "+" signs right from regex without waiting for my pretty link to do it?
Does anyone see a solution?
Julien.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Question about java.text.Normalizer
 
Similar Threads
Foreign key field population from datatable to textbox?
JSF portlet form fields retrieval
Problem with a h:panelGrid and a ui:repeat
Issue with jstl + facelets
popup