On 6/01/2012 8:03pm, Russell Keith-Magee wrote:
On Fri, Jan 6, 2012 at 1:43 PM, Mike Dewhirst<[email protected]>  wrote:
I think I have found a workaround but it will probably blow up in my face
due to encoding/decoding things I don't fully understand.

Can anyone comment on the robustness of calling the following method in a
model's save() ...

Well... it will fail as soon as you have an sample of magnetite or
haematite (Fe3O4 and Fe2O3 respectively) -- your code capitalizes all
characters in the final else block, including the "e" in Fe.

However, if you fix the logic problem, and you set the server encoding
of your page to be UTF-8, and serve it with UTF-8 page headers, it
should work fine -- or at least as well as the font on your customer's
browser allows. See [1] for more details on what you need to do to
serve UTF-8.

I'm totally over quirks and IE6 so I'll stick to html5 for utf-8 in this project. It is only the prototype phase. When it acquires a team it will probably be a different story.


The other option is to use the<sub>  HTML tag; this provides slightly
better typographic support, since it's actually a typographic
subscript, rather than a unicode codepoint trying to emulate the
typography. This also won't be subject to any UTF-8 encoding problems.

If you look at the Wikipedia page for Iron Oxide [2], you'll see that
they use the<sub>  approach. Implementing a Django template filter to
convert "Fe2O3" into "Fe<sub>2</sub>O<sub>3</sub>" wouldn't be too
hard to do.

It does look much better. How does one persuade the Admin app that such data is safe?

Perhaps I'll stick with unicode for the prototype.

Thanks

Mike

[1] http://www.w3.org/International/articles/serving-xhtml/Overview.en.php
[2] http://en.wikipedia.org/wiki/Iron_oxide

Yours,
Russ Magee %-)


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to