0

If using SVGs for graphic icons and not displaying any less typical characters (let alone any characters at all), is there an observable difference in UTF-8 XML encoding vs ISO-8859-1?

I get a few bytes smaller when I save UTF-8, but I'm guessing that's because the word is shorter, wondering if because of the larger char-set for encoding on UTF-8 if there are any cases where it could have the opposite?

Or is the encoding unlikely to have any effect on the file size in this case?

zx485
  • 28,498
  • 28
  • 50
  • 59
Andrew Clavin
  • 574
  • 2
  • 15

2 Answers2

2

ISO 8859-1 is more compact for characters in the range 128-255, UTF-8 is more compact for characters above 255, so it all depends on the statistical distribution of the characters in your document. If you're concerned about the number of bytes then there are much better ways of reducing the size than worrying about the encoding.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164
0

You can easily measure this by yourself.

  1. Construct an intersection of both char-sets.
  2. All remaining chars make the difference.
  3. Add the byte consumption of the first step to both sets separately to get the cardinality of the two new sets.
  4. Now you got the byte consumption of each set in integer values.

This is the algorithm to measure which char-encoding is more efficient by byte-count.

zx485
  • 28,498
  • 28
  • 50
  • 59