• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Question about java.text.Normalizer

 
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Julien Martin
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
He was giving me directions and I was powerless to resist. I cannot resist this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic