On 28/03/19 10:38, Tony van der Hoff 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.

How about this function (python3):

def char2html(l):
    return '&#%d;' % ord(l)

-- 
Antoon Pardon


-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to