Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6560601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:28:55+00:00 2026-05-25T13:28:55+00:00

I am trying to read a DB table contents and display it as a

  • 0

I am trying to read a DB table contents and display it as a web page using mako and bottle. The table has some Unicode (utf-8) fields in it.

UnicodeDecodeError('ascii', 'MOTOROLA MILESTONE\xe2\x84\xa2 PLUS', 
                   18, 19, 'ordinal not in range(128)')

With the following stack trace:

Traceback (most recent call last):
  File "/workspace/web/controller/bottle.py", line 499, in handle
    return handler(**args)
  File "webserver/webserver.py", line 101, in download
    return html_tmpl(tmpl, **kwds)
  File "webserver/webserver.py", line 116, in html_tmpl
    return tmpl.render(**kwds)
  File "/usr/lib/python2.5/site-packages/Mako-0.3.4-py2.5.egg/mako/template.py", line 189, in render
    return runtime._render(self, self.callable_, args, data)
  File "/usr/lib/python2.5/site-packages/Mako-0.3.4-py2.5.egg/mako/runtime.py", line 403, in _render
    _render_context(template, callable_, context, *args, **_kwargs_for_callable(callable_, data))
  File "/usr/lib/python2.5/site-packages/Mako-0.3.4-py2.5.egg/mako/runtime.py", line 434, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/usr/lib/python2.5/site-packages/Mako-0.3.4-py2.5.egg/mako/runtime.py", line 457, in _exec_template
    callable_(context, *args, **kwargs)
  File "download_android_index_html", line 41, in render_body
  File "download_android_index_html", line 23, in fill_devices
  File "download_android_index_html", line 68, in render_fill_devices
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 18: ordinal not in range(128)

The calling function is:

def html_tmpl(tmpl, **kwds):
    kwds['nav'] = templates_lookup.get_template('nav.html').render()
    kwds['nav_bottom'] = templates_lookup.get_template('nav_bottom.html').render()
    base_path = request.path.replace("de/","").replace("fr/","")
    kwds['languages'] = templates_lookup.get_template('languages.html').render(en_url=base_path,fr_url="/fr"+base_path)
    kwds['analytics'] = ''
    return tmpl.render(**kwds)

How do I go aboutthis? I’ve tried:

return tmpl.render_unicode(**kwds)` 

and

return tmpl.render_unicode(**kwds).encode('utf-8', 'replace')

with no luck, and this answer did not help much.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:28:55+00:00Added an answer on May 25, 2026 at 1:28 pm

    The problem is not that render_unicode cannot convert a python unicode object into utf8, its that a string object exists, which it assumes is ascii, and that holds non ascii data.

    Start at the beginning – decode all incoming strings into unicode internally. You have a string input that needs fixing.

    I suggest you try naming all variables at the boundary with a sort of hungarian notation – perhaps rawstr_myvar and u_myvar.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a Table of Contents for a small publication using Filemaker
Trying to read an RSS and select information using Linq but can't seem to
I'm currently trying to read in an XML file, make some minor changes (alter
I am trying to do some experiments using different segments besides the default code
I have an HTML table in my page that I'm trying to replace with
I am using a loop to read the contents of an array, which contains
I am trying to make my Ajax-enabled table pagination 508-compliant (accessible using JAWS version
I'm trying to lay out a web page like this: |-----------------------| | header (fixed)
I'm trying to use Selenium with Python to store the contents of a table.
I want this in R: fsC=[read.table(x) for x in Sys.glob('./Trial7/*.csv')] i.e. trying to read

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.