6

I have a string in my maven project and when I run it on my local machine, I have

String name = title.get(i).text().replace("é", "e");

Later I save the variable name to a file

But then when I export to .jar and run the it on my server I see é not e, but when I run on my local machine I see "e" which is what I want.

What is happening?

Srijani Ghosh
4,2667 gold badges42 silver badges70 bronze badges
asked Aug 23, 2015 at 23:18
6
  • What is the type of title? Commented Aug 23, 2015 at 23:27
  • 8
    I don't think you've given enough information to answer this question. It probably has something to do with the platform's default charset or file encoding, and nothing to do with String.replace. Commented Aug 23, 2015 at 23:29
  • @ChrisMartin when you say platform you mean the server I am trying to run it on?, but it runs normal java how would it not do replace? Commented Aug 23, 2015 at 23:32
  • 1
    @spenf10 try this or this Commented Aug 23, 2015 at 23:36
  • Where are the text values coming from? I wonder if perhaps your strings contain the single character '\u00e9' when you run the program locally, whereas the strings on your server contain the sequence '\u0065\u0301'. If that's the case, you can create a Matcher outside your loop using Matcher matcher = Pattern.compile("e", Pattern.CANON_EQ).matcher("");, and inside your loop, you can do String name = matcher.reset(title.get(i).text()).replaceAll("e");. Commented Aug 25, 2015 at 0:32

1 Answer 1

1

If you are trying to change that from a web page you may want to try:

String name = title.get(i).text().replace("%C3%A9", "e");
answered Nov 6, 2015 at 23:49
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.