Hi i have web application which uses mailto like
Send email
but no meter what i do it alway replace space with + sign
Try to decode your String
just use Uri.encode(String).
subject = (EditText) findViewById(R.id.subject);
subject.setText(Uri.encode(WhatEverYourStringVarIs));
This will help you to decode the URIencode.
If you mean the PHP (HTML) Issue just do the same:
$encodeString = urlencode($encodeString);
echo $encodedString;
So the String will displayed proper.
See this url encode.
Okay, but when i'm read your Question the third time: You can use Spaces in these HTML case. It is an Android Bug. Just use this:
Send Mail
Related
i have a url link am trying to send to my user, but the link breaks up cause. it sends the full link but about half of it is not underlined as a link. this is what am trying to send
String locateUrl="http://maps.google.com?q="+latitude()+","+longitude();
first it does not recognize this ?q= as a link and it just breaks up from there, have checked other answers and tried them but seems not to be working
Just solved this by putting "/" before ?q= thereby making sure the link doesn't break
full link will then be
String locateUrl="http://maps.google.com/?q="+latitude()+","+longitude();
Your link may be breaking because of space at the beginning or in between trim it and then use it.
String locateUrl="http://maps.google.com?q="+latitude()+","+longitude();
locateUrl = locateUrl.trim();
I am calling a web service through async task which is returning text in strange format. here is sample string
dhmot_enot = Ï. ÎÎ®Î¼Î¿Ï ÎοÏλαÏ
zoe_name = Î.Î.Î: ÎÏÎ½ÎµÏ Î ÏοÏÏαÏÎ¯Î±Ï ÎÏοÏÏ Î¥Î¼Î·ÏÏοÏ
zones_zoe = ÎΩÎÎ Î: ÎÎ ÎÎΥΤΠΠΡÎΣΤÎΣÎΠΤÎΣ ΦΥΣÎΣ
zoe_fek = 187/Î/2011
fek_rel = 544/Î/1978
yphresia = Î¥.ÎÎÎ Î. ÎάÏηÏ-ÎοÏλαÏ-ÎοÏλιαγμÎνηÏ
How to find and resolve this ?
Update 1
Here is the actual service link that i am calling from server (works well in web browser ) but when i call from android it looks like above
http://geo-polis.gistemp.com/geoserver/wms?service=WMS&version=1.1.1&srs=EPSG:4326&bbox=23.733829893171787,37.75098946973509,23.839769437909126,37.89294194933182&styles=&&buffer=20&OUTPUTFORMAT=json&request=GetFeatureInfo&layers=geopolis:oria_eniaiou_dhmou&query_layers=geopolis:oria_eniaiou_dhmou&width=1080&height=1832&x=690&y=821
The response is a normal UTF-8 encoded stream of data. To see this, go to the URL you show in your post in the browser, and look at the encoding it picked automatically: it'll show unicode/utf-8 as character encoding for the response. If you change that, forcing the browser to decode it as if it's ANSI encoded (windows codepage 1252/ISO-8859-15) then the text turns into the gibberish you were showing in your question, so: you're not decoding the data correctly, and need to make sure to decode as utf8.
I'm currently developing a web app and there is this part of the code where I have to pre-populate the message in the sms box. So my code looks like this:
SMS
In the pre-populated message, everything from the & symbol onwards does not appear in the message box on the phone. I know I have to encode it but I do not know what the encoding code is. Any solution to this? Thanks.
This seems really crazy but encoding the body twice does the trick.
not encoded (doesn't work)
uri component encoded (doesn't work)
double uri component encoded (works fine)
Working fiddle to test from an android device: https://jsfiddle.net/k96g2h48/
Android and iOS respond to slightly different syntaxes. To put & inside the body of text, iOS needs URL encoding. For Android, it requires double encoding as mentioned in #Crisman's answer. check the below code:
iOS
<br>
double uri component encoded (works fine)
The first link worked in iOS and the second link works in Android.
Notice the syntax of both URLs. & and ? with this they with & ios distinguish between number and body part whereas ? is used to separate number and body.
An example with number is like
iOS
<br>
double uri component encoded (works fine)
You can also try this fiddle
Encode your & character because it has a special meaning in an URL ( it is the separator for fields)
SMS
The characters that have a special meaning in URL need to be ecnode if you just want there text respresentation.
wikipedia on percent encoding
Try using & instead of "&" as this is the ASCII version of the character and used to show up as text in a HTML document
I think you need to write like below
SMS
Have you try this char \u0026?
SMS
reference from - https://stackoverflow.com/a/3705601/10989990
EDIT
Some browsers will accept & and some browsers will not accept this char so everything after & will be considered as the query parameter
EDIT
may be javascript helps to use
<!DOCTYPE html>
<html>
<body>
<script>
var txt = "SMS";
document.write("<p>" + txt.link("sms:?body=This is the message with & symbol") + "</p>");
</script>
</body>
</html>
Good Luck :)
I'm having a slight problem opening a certain URL in the browser. First of all I use the following code to launch the browser:
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(Globals.currentChatURL));
startActivity(Intent.createChooser(browserIntent, "Select browser:"));
Now if I set Globals.currentChatURL to something like http://www.google.com then it opens that site just fine. But my URL is a little more complicated as it contains multiple parameters which are all base64 encoded. Here is an example of how my URL looks:
http://webportal.mysite.com/ChatProgram/chat.php? intgroup=UFYyMA==&intid=UFYyMEZN&hg=Pw__&pref=user&en=U0NPVFQgTUlMTEFS&ee=cGF1bGdAbWFnbmF0ZWNoLmNvbQ==&eq=UFRWRkVI&ec=TUFHTkFURUNI
Now if I use my above code to try and launch this URL it brings me to the Google search page with the following message:
"Your search - http://URLabove ... did not match any documents"
Yet if I copy the URL and paste it into the address box it brings me to the right place. How can I fix this?? The whole point of this is to have the user click the button and the site to launch, not for the user to have to copy and paste the URL manually.
Any suggestions would be greatly appreciated.
Thanks a lot
There is unwanted equal signs in the query part of your http URI. Such signs have a specific meaning as delimiters in the form ¶meter=value.
This equal signs represents padding values (0, 1 or 2) from your base64 encoding.
You can either
remove them because your base64 server decoder won't bother reconstructing them, or
percent encode them (with all other reserved characters).
In android you can use percent encode this way:
String value = URLEncoder.encode("annoying values with reserved chars &=#", "utf-8");
String url = "http://stackoverflow.com/search?q=" + value;
The RFC 2396 is now deprecated but that is what URI.parse() is based on as stated by the documentation:
uriString an RFC 2396-compliant, encoded URI
If a page has a URL or a phone number on it that isn't a link is there any way to have WebView recognize it and automatically turn it into a link like you can with TextViews?
With a TextView you would simply set the android:autoLink to the desired settings:
<TextView
android:autoLink="web|phone"
... />
but I can't find any equivalent for WebView.
If you are loading your own (web) content from a String, then you can do something like this:
final String content = "My email is: firstname#email.com ...";
Spannable sp = new SpannableString(content);
Linkify.addLinks(sp, Linkify.ALL);
final String html = "<body>" + Html.toHtml(sp) + "</body>";
myWebView.loadData(html, "text/html", "utf-8");
I don't know about any way which would make this work just by changing a setting, but a workaround would be to wait until the web page finishes loading and then do:
yourWebView.loadUrl("javascript:(function(){ /* code that creates links */ })()");
This will inject javaScript into the already loaded web page.
There's a slightly longer example available here: http://lexandera.com/2009/01/injecting-javascript-into-a-webview/.
You can find the JavaScript source for creating links if you take a look at the source of Linkify script for Greasemonkey (it's a plugin for Firefox in case you're not familiar with it). I believe it comes with the default install.