Prepare accented characters for HTML

Chris Angelico rosuav at gmail.com
Thu Mar 28 08:08:28 EDT 2019


On Thu, Mar 28, 2019 at 10:55 PM Tony van der Hoff <lists at vanderhoff.org> wrote:
>
> On 28/03/2019 11:02, Chris Angelico wrote:
> > On Thu, Mar 28, 2019 at 8:58 PM Tony van der Hoff <lists at vanderhoff.org> wrote:
> >>
> >> Hi,
> >>
> >> I have a MariaDB database, which contains accented (mostly French)
> >> characters. I need to display these on an HTML page. I'm using the Jinja
> >> templating engine.
> >>
> >> So, for instance, é needs to be replaced by é and so on. I've had
> >> some success using string.replace(), but it is difficult to cater for
> >> every case.
> >
> > Why not just include them as-is? Modern web browsers should have no
> > trouble at all.
> >
> > ChrisA
> >
> Thanks, Chris. The problem is not with the browser, but Jinja crashes.
> Probably a bug, but I'm too wedded to that engine to change now. I'll
> raise it on the Jinja bug site.
>

Ah. Yeah, I would definitely raise that with Jinja. Or you could just
raise *that* issue here on the list and see if anyone knows a
solution/workaround (obviously with posting the full error message
etc). It may make a difference whether you're working with Unicode
strings or UTF-8 encoded byte strings, too.

ChrisA



More information about the Python-list mailing list