324

Since AVD tools 16 I'm getting this warning:

Replace "..." with ellipsis character (..., …) ?

in my strings.xml

at this line

 <string name="searching">Searching...</string>

How do I replace ...? Is it just literally &#8230;?

Could someone explain this encoding?

Zoe
  • 27,060
  • 21
  • 118
  • 148
Blundell
  • 75,855
  • 30
  • 208
  • 233
  • As a note, I've noticed that some of Android's own translated string files use … itself rather than the Unicode entity. Given that Android XML files are normally encoded in UTF-8 anyway, I see no reason not to use the character itself rather than the potentially-esoteric Unicode entity, especially as most word processing programs these days support autocorrecting "..." to "…" (Microsoft Word does it by default, last I checked). – JAB Feb 11 '14 at 19:38
  • Is it actually three dots (ASCII 46 / 0x26)? Or ASCII 133 (one character)? – Peter Mortensen Jan 15 '17 at 19:01
  • 3
    At the answer of another SO question, there's a better explanation than 'Change ... into the Unicode because it's better'. https://stackoverflow.com/a/27984145/973919 In short, it prevents the three dots from being split on a multi line text (showing 1 or 2 dots alone) and in some typographies it looks bad to see 3 dots. – xarlymg89 Jun 21 '19 at 12:47

7 Answers7

557

&#8230; is the unicode for "" so just replace it. It's better to have it as one char/symbol than three dots.

WarrenFaith
  • 57,492
  • 25
  • 134
  • 150
  • Thanks when I understand unicode, when I was first replacing it, eclipse was changing my & into & (I had double &&) . Fixed! – Blundell Dec 16 '11 at 15:46
  • 50
    Why is it "better"? This complicates things when giving the text to translators. Can we somehow kill this stupid warning? Thanks – swinefeaster Jan 02 '12 at 03:04
  • @swinefeaster Yes you can disable it in the project properties. Anyway, as a German I can guarantee you, that I prefer English over translated nonsense (when you refer to translator software, not professional ones) – WarrenFaith Jan 02 '12 at 03:54
  • 25
    @swinefeaster good to know :) but as they are payable, they are teachable, too :) – WarrenFaith Jan 02 '12 at 05:17
  • @swinefeaster see florian answer – Tofeeq Ahmad Jan 22 '13 at 10:32
  • 32
    @swinefeaster It's "better" in part because it doesn't break ("..." might wrap around on e.g. the second period), and theoretically languages could render them differently (many asian languages put them in the middle and they're wider (matches a character width)). Non-breaking is useful everywhere, I'm not aware of Android rendering them correctly in other langs though, nor am I aware of UTF characters for this purpose. – Groxx Dec 30 '13 at 23:33
  • 15
    Having "..." causes accessibility issues. Android Talkback reads "Loading..." as "Loading 3 period" – Mohammad Shabaz Moosa Nov 09 '15 at 13:04
  • 1
    @MohammadShabazMoosa interesting. Thanks for sharing that! Can you also share if it says "dot dot dot" in case of use three dots instead of that special char? – WarrenFaith Nov 09 '15 at 13:45
  • 17
    It seems my comment wasnt clear. Using "loading..." (3 dots) leads Talkback to say "loading 3 period" Using "Loading…" (ellipsis) leads Talkback to say "Loading" [Which is good.. ] So, we should use ellipsis always – Mohammad Shabaz Moosa Nov 10 '15 at 07:20
  • 1
    @MohammadShabazMoosa ah got you! Thanks for clearing that up! – WarrenFaith Nov 10 '15 at 08:37
  • 4
    @swinefeaster you don't really have to use XML code character, you can just paste the "…" character. The same applies for typewriter quotes. – Yaroslav Mytkalyk Mar 04 '16 at 10:51
  • Always remember to put the `;` in the end – Rodrigo João Bertotti Jan 30 '18 at 01:40
  • @MohammadShabazMoosa This doesn't appear to be the case anymore, at least on my test on Android 11. – Merk Apr 21 '22 at 17:49
16

To make thing short just put &#x2026; in place ...

Link to XML character Entities List

  • Look at Unicode column of HTML for row named hellip
Jadeye
  • 3,551
  • 4
  • 47
  • 63
  • 5
    I initially wondered why you used `…` when the Eclipse warning says to use `…` but your link does answer that. Namely that the x signifies a hex value and 8230 in decimal is 2026 in hex. – k2col May 27 '14 at 21:44
  • where to put this … any location for this. – Tushar Pandey Apr 16 '15 at 05:07
  • @TusharPandey- if your code is Searching... then it will look something like Searching… – Jadeye Apr 18 '15 at 20:33
13

If you're using Eclipse then you can always do the following:

  • Right click on the warning
  • Select "Quick Fix" (shortcut is Ctrl + 1 by default)
  • Select "Replace with suggested characters"

This should replace your three dots with the proper Unicode character for ellipsis.

Just a note: The latest version of ADT (21.1) sometimes won't do the replace operation properly, but earlier versions had no problem doing this.

This is the character:

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Michael Celey
  • 12,645
  • 6
  • 57
  • 62
  • This worked for me! However nothing "visual" happened other than the warning disappeared, and I'm running ADT 22.2.1. But i guess thats how it works :) – ymerdrengene May 20 '14 at 09:50
  • Didn't worked for me. Eclipse sugested me (I don't know why) to surroud tag with a new tag. – Leonardo Raele Aug 11 '14 at 13:52
  • Eclipse will do that sometime if you don't exactly highlight the right area. I find myself highlighting and trying to quick fix two or three times before it actually makes the right suggestion. – Michael Celey Aug 11 '14 at 15:43
8

The solution to your problem is:

Go to Window -> Preferences -> Android -> Lint Error Checking

And search for "ellipsis". Change the warning level to "Info" or "Ignore".

akjoshi
  • 15,374
  • 13
  • 103
  • 121
Florian Fischer
  • 129
  • 1
  • 2
  • 9
    Those suggestions do make sense. Simply ignoring them is only a solution, if you are really sure, what you are doing. In this case, the replacement makes sense, so ignoring the warning is not good. – Alexander Pacha Dec 02 '12 at 16:29
  • Thanks! Just what I was looking for. And that's the place to do all sorts of related things (I don't need a computer to tell me how to spell, capitalize, or punctuate). Very useful! – SMBiggs Jan 15 '13 at 17:41
  • 3
    this is not a good option to do ignore the warnings. you should fix the warnings for better results. – Deepak Jan 06 '15 at 10:27
  • 2
    @ScottBiggs to be fair, if the computer is telling you that you have spelled, capitalized, or punctuated something incorrectly, then you ought to fix it. Lints are useful in that regard, I advise against disabling them. – EpicPandaForce Jan 20 '15 at 12:49
3

This answer is indirectly related to this question:

In my case textView1.setTextView("done&#8230"); was showing some box/chinese character. Later, I checked into fileformat.info for what the value represents and I found this is a Han character. So, what to do? I searched for "fileformat.info ellipse character" and then everything became clear to me once I saw its values are;

UTF-16 (hex) 0x2026 (2026)

UTF-16 (decimal) 8,230

So, you have several encoding available to represent a character (e.g. 10 in Decimal is represented as A in hexa) so it is very important to know when you are writing an unicode character, how receiving function decodes it. If it decodes as decimal value then you have to provide decimal value, if it accept hexadecimal then you have to provide hexadecimal.

In my case, setTextView() function accepts decimal encoded value but I was providing hexadecimal values so I was getting wrong character.

seoul
  • 864
  • 1
  • 12
  • 32
3

The quick fix shortcut in Android Studio is Alt + Enter by default.

Hasan El-Hefnawy
  • 1,249
  • 1
  • 14
  • 20
1

Best not to ignore it as suggested by some, it seems to me. Use Android Studio to correct it (rather than actually typing in the character code), and the tool will replace the three dots with the three-dot unicode character. Won't be confusing to translators etc.

Kofi
  • 524
  • 5
  • 7