On 06/01/2012, at 8:03 PM, Russell Keith-Magee <russ...@keith-magee.com> wrote:
> On Fri, Jan 6, 2012 at 1:43 PM, Mike Dewhirst <mi...@dewhirst.com.au> 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, Ah! I'll remove the upper(). Thanks. For the rest of your advice, I'll go straight back to the drawing board - er, docs. Much appreciated Mike > 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. > > 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. > > [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 django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.