0

So my end goal is to have a minus-plus symbol show up in a webview field on an android application.

Right now i'm using some very light javascript files at http://mathscribe.com/author/jqmath.html to display my math equations. There doesn't seem to be any special code to display the minus-plus character. They simply say to save your file in UTF-8 and I think you're supposed to copy a minus-plus character directly into the file (also note I can copy a plus-minus character into the file without any problems).

When I copy-paste the minus-plus character into eclipse, it sometimes displays correctly while other times can't display (will show a box with a question mark in it). Strangely this can happen in the same file. I put the character in one place in the file it will display, while at another place it will not display. When I run the program as an android application and view it on the android virtual machine, the character will not display either way. The android virtual machine is running Android 4.4 API - 19. I can't quite tell what the browser version is.

So, I'm wondering if there is anyway to display this character for the majority of android users. I don't understand encodings fully but isn't the minus plus character part of utf 8? I discovered its unicode value is 2213. Doesn't this mean I should be able to display it in my UTF-8 file in eclipse and shouldn't it show up in the android webview? Thanks,

-Teneth

bluemoon12
  • 73
  • 1
  • 8

2 Answers2

0

For ± in HTML/XML just use this character reference:

±
Aleizdein
  • 404
  • 3
  • 9
  • 1
    I'm tryin to display the minus-plus sign where the minus is ontop of the plus. The html code for this is ∓ but it still doesn't display correctly. However your answer led me to this question http://stackoverflow.com/questions/4933069/android-webview-with-garbled-utf-8-characters?lq=1 which might address my issue. Apparently the webview doesnt always display utf-8. However, I can't figure out the right syntax. I'm trying to load an html file from my assets folder and im not sure which loadUrl type command to use... – bluemoon12 Jan 22 '15 at 22:45
  • I would use this one: webView.loadData( data_to_load, "text/html; charset=UTF-8", null ); – Aleizdein Jan 23 '15 at 06:31
  • Hm, now i'm getting confused. I've tried different load data commands (including the loadData one) and it still doesn't load the minus plus character. Can every browser load UTF-8? It looks like theres about 10175 characters in UTF-8. Should every browser be able to display all of these? Just trying to figure out if the minus plus character is a special case. – bluemoon12 Jan 23 '15 at 20:43
  • Oh that 10175 might be something else but I guess what I'm wondering still stands - does every browser load every UTF-8 character? Should every browser be able to show the minus-plus character? – bluemoon12 Jan 23 '15 at 20:48
0

we can directly use \u002B for plus sign and \u2212 for minus sign and \u00B1 for plus-minus sign. Hope it will help you

Yogendra
  • 11
  • 4