web hosting and development forums
Web Design and Development Forums Archive


Index - JAVA programming forum

how to replace characters in a string


Post reply

How do i replace all character 'ы' with 'u' in a String? Str.replace('ы', 'u'); Does nothing..
Show us the code of the failing test.
Does nothingпјџ Paste your code
autos, you cannot change a String.
Str = str.replace
Doesn't 'replace()" return a new string?
Ah..
String s = myString.replaceAll('ы', 'u');
I dont understand this: Java.io.IOException: Server returned HTTP response code: 400 for URL: http://blablabla/ The url looks fine to me:s
Maybe the space characters need to be escaped
But other urls that looks the same work.. Hmm i see the problem
HS^, space, the final frontier.
How do i escape a space?
%20
I the browser it puts %20 or something Ok I just replace spaces wiht %20
~javadoc URLEncoder
Klimapol, please see java.net.URLEncoder: http://java.sun.com/j2se/1.5.0/docs/api/java/net/URLEncoder.html
You can use either %20 or +
"The space character " " is converted into a plus sign "+". " Ok
Poolkop, I forget that. ;)
It also encodes: в Chars like that?
HS^, did you type some non-ASCII then?
HS^, urls are only ascii if you try to put anything non-ascii into an url you need to encode it... and then you start having problems...
Yes but will so will URLEncoder replace non-ascii ?
HS^: since there is no standard how you encode non-ascii characters... (utf-8? latin-1? <other encoding>?)
Ah.. ok
HS^, tias... depending on how the client is configured and the web server is configured it may or may not work... but if the client uses one encoding and the server another then the error is in a the specification beeing to loose
Doesnt work.. I just rreplace the spaces wih '+'
HS^, only use URLEncoder on those parts of the String that need encoding. HS^, are you using the encode(String) or encode(String,String)?
HS^, you are having a url and URLEncoder is for "HTML form encoding" url is not a html form, they may partially use the same encoding....
Ok I just need url




Dubai Forum | Paris Forum | Webmaster Forum | Vegan Forum | Brisbane Forum | 3D Forum | Jobs in Dubai | Jobs in London | London UK Classifieds
Archive script by RedHo.com