Forum Moderators: open

Message Too Old, No Replies

Use of − instead of hyphen

Is − widely supported?

         

directrix

8:11 am on Jul 3, 2006 (gmt 0)

10+ Year Member



I'm planning to use − to display the minus sign. On supporting browsers it is wider than the regular hyphen ('-'), and about the same width as the plus sign.

Is − widely supported? On different browsers, versions, and platforms?

I'm using the iso-8859-1 charset, if that is significant. Most of my visitors are from the English-speaking world, including India.

penders

12:50 am on Jul 4, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I can't say I've used the − mnemonic before, it's not listed in my HTML 3.2 Quick Reference book from yesteryear(!), but it is in the HTML 4.0 and XHTML 1.0 standards as far as I can see.

After having had a bit of a play...

It displays very similiar to the – character. In most browsers it displays the same, except in Opera (8) where − has slight padding left and right (as a minus sign should have, come to think).

− is supported by (Windows) on:
IE5, IE6, Firefox 1.0, 1.5, Opera 8, Mozilla 1.6

It's not supported by Netscape 4 (and neither is the numeric equivalent of −), but then what is?! – is not supported either.

As long as it works ok on the Mac then I'd say yes - use it. (− may come from the Symbol font)

directrix

1:48 pm on Jul 4, 2006 (gmt 0)

10+ Year Member



Thanks, I think it will be OK in most configurations, at least in the US and UK. I'm just concerned that I'm not aware of all the factors that need to be considered.

For example, I know that some other entities, such as ∴, display fine on some Windows/IE browsers in the UK, but not on others. I don't know what accounts for the difference.

Also, I have a lot of visitors from India, so I'd like to know if there is anything about the typical setup in India that could influence whether display problems with − would be rare, or quite common.

Any general pointers on this topic would be appreciated!

Robin_reala

9:48 pm on Jul 4, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Why not use UTF8? That way you can just use the unicode character directly. Fwiw the minus symbol is U+2212.

penders

10:42 am on Jul 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I do *think*, however, that regardless of whether you use utf-8 encoding, the ability to display certain characters is also dependant upon what fonts are installed (and to some extent what browser).

The 'minus' character talked about above is in both the standard Windows Arial and Times New Roman fonts. However, the "there4" (U+2234 three dots) character isn't - I've found it in the Symbol font - which may explain why some users may have a problem. This is illustrated by Netscape 4 (just acting as an example) which can only display chars from the current font. It displays the minus char (−) ok, but not 'therefore' (∴).

Arial and Times New Roman seem to have a gap in the unicode table between U+222B and U+2248.

Also, for maximum compatibility with old old browsers you should use decimal character entities (like −) rather than the hex equivalent (−)

directrix

1:40 pm on Jul 6, 2006 (gmt 0)

10+ Year Member



Thanks, penders, it's very useful to know why − might appear but not ∴. You recommend &8722; over the hex equivalent. How about &8722; vs. −? Is one more widely supported than the other?

Thanks, Robin_reala, but I don't want to open a whole new can of worms by moving to UTF8! At least, not yet.

penders

6:15 pm on Jul 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



− may be better supported than − in older browsers. I don't know quite how old though. Certainly Netscape 4 supports − but does not support − Does IE4 support −? However, − is easier to type!

ASIDE: I don't know if it is possible that on some (strange) systems the minus sign is not character #8722, but something else entirely. In which case − is more likely to map to the correct character. (But that may be just very hypothetical!)

Yes, I have encountered a few problems before when switching from iso-8859-1 to utf-8. One was the copyright symbol, which I had typed directly into the html, instead of using © (since it was in the copyright meta tag) - switching to utf-8 caused it to display as a '?'.

Robin_reala

9:08 pm on Jul 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



penders - were you saving your files in a UTF-8 compatible editor? For example, in Notepad you specifically have to save as UTF-8. Hopefully these days more and more editors are saving as UTF-8 by default though.

penders

4:41 pm on Jul 7, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi Robin, no I must admit at the time I did not appreciate I would need to save the document as UTF-8 ... something which has 'clicked' more recently! The editor I use (HTML-Kit) unfortunately does not support saving/native UTF-8, although it does allow you to insert/convert sections to UTF-8 within a standard encoded document, which helps, but is hardly a solution. Thanks.

Robin_reala

12:35 am on Jul 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



To be fair, character encoding is a mess at the moment. Gradually though it should sort itself out (if we ignore the Han unification issue [en.wikipedia.org]...). There's really no reason apart from ignorance and editor support for not supporting UTF-8/16 at the moment, and those will gradually go away. I suspect that within 5 years this will cease to even be a problem.

directrix

12:15 pm on Jul 8, 2006 (gmt 0)

10+ Year Member



On the topic of UTF-8, here is a great post from last year by encyclo: [webmasterworld.com...]