title: UnicodeDecodeError in Google App Engine
body: <p>In my project (using Python, Html &amp; Jinja2) I have a home_page with movie pictures that each picture leads to a specific page with the movie data. When I try to present the page with the movie data I'm getting the following error(I tried to remove each element such as removing moving.summary and the error then flagged on the above paramter):</p>
  
  <pre><code>    Traceback (most recent call last):
        File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line 1536, in __call__
          rv = self.handle_exception(request, response, e)
        File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line 1530, in __call__
          rv = self.router.dispatch(request, response)
        File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line 1278, in default_dispatcher
          return route.handler_adapter(request, response)
        File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line 1102, in __call__
          return handler.dispatch()
        File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line 572, in dispatch
          return self.handle_exception(e, self.app.debug)
        File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line 570, in dispatch
          return method(*args, **kwargs)
        File "C:\Users\User\Desktop\imovie-good\main.py", line 77, in get
          self.response.out.write(template.render(template_values))
        File "C:\Program Files (x86)\Google\google_appengine\lib\jinja2\jinja2\environment.py", line 894, in render
          return self.environment.handle_exception(exc_info, True)
        File "C:\Users\User\Desktop\imovie-good\movie_data.html", line 7, in top-level template code
          &lt;td&gt; Movie Name: {{movie_data.name}}&lt;/td&gt;
      UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position 0: ordinal not in range(128)
  </code></pre>
  
  <p>This is my python code:</p>
  
  <pre><code>    import webapp2
      import jinja2
      import os
      import datetime
      import time
      import cgi
      from google.appengine.ext import db
      from google.appengine.api import users
      from google.appengine.api import images
  
  
      jinja_environment = jinja2.Environment(
      loader=jinja2.FileSystemLoader(os.path.dirname(__file__)))
  
      class Movie(db.Model):
          name = db.StringProperty()
          release_date = db.StringProperty()
          duration = db.StringProperty()
          director = db.StringProperty()
          actors = db.StringProperty(multiline=True)
          summary = db.StringProperty(multiline=True)
          picture = db.BlobProperty()
          trailer = db.StringProperty(multiline=True)
          date = db.DateTimeProperty(auto_now_add=True)
  
      class Movie_Data(webapp2.RequestHandler):
          def get(self):
              movie_key = self.request.get('movie_key')
              movie_data = Movie.get(movie_key)
  
      template_values = {'movie_data': movie_data}
              template = jinja_environment.get_template('movie_data.html')
              self.response.out.write(template.render(template_values))
  
      class Image(webapp2.RequestHandler):
          def get(self):
              movie = db.get(self.request.get('img_id'))
              if movie.picture:
                  self.response.headers['Content-Type'] = 'image/jpeg'
                  self.response.out.write(movie.picture)
              else:
                  self.response.out.write("No Image")
  
      class Main(webapp2.RequestHandler):
          def get(self):
              movies = db.GqlQuery("SELECT * "
                                  "FROM Movie "
                                  "ORDER BY release_date DESC LIMIT 5")
              template_values = { 'movies': movies}                                   
              template = jinja_environment.get_template('home_page.html')
              self.response.out.write(template.render(template_values))
  
      class Admin(webapp2.RequestHandler):
          def get(self):
              template_values = {}
              template = jinja_environment.get_template('admin.html')
              self.response.out.write(template.render(template_values))
  
  
          def post(self):
              name = self.request.get('name')
              release_date = self.request.get('release_date')
              c = time.strptime(release_date,"%m/%d/%Y")
              release_date = time.strftime("%m%d%Y",c)
              duration = self.request.get('duration')
              director = self.request.get('director')
              actors = self.request.get('actors')
              summary = self.request.get('summary')
              picture = self.request.get('img')
              trailer = self.request.get('trailer')
  
              movie = Movie(key_name = name)
              movie.release_date = release_date
              movie.duration = duration
              movie.director = director
              movie.actors = actors
              movie.summary = summary
              movie.picture = db.Blob(picture)
              movie.trailer = trailer
              movie.put()
              self.redirect('/')
  
  
  
      app = webapp2.WSGIApplication([('/admin', Admin), ('/', Main), ('/img', Image), ('/movie_data', Movie_Data)], debug=True)
  </code></pre>
  
  <p>This is my html for the home_page:</p>
  
  <pre><code>    &lt;html&gt;
      &lt;body&gt;
          &lt;table&gt;
              &lt;th&gt;Top Movies&lt;/th&gt;
  
              {% for movie in movies %}
              &lt;tr&gt;
                  &lt;td&gt;{{movie.key().name() }} &amp;nbsp&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;&lt;a href = "/movie_data?movie_key = {{movie.key()}}"&gt; &lt;img src = "/img?img_id={{movie.key()}}"&gt; &lt;/td&gt;
  
  
              &lt;/tr&gt;
  
              {% endfor %}
  
              &lt;a href = "/admin"&gt;admin&lt;/a&gt;
  
          &lt;/table&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This is my movie_data html code:</p>
  
  <pre><code>  &lt;html&gt;
      &lt;body&gt;
          &lt;div&gt;
              &lt;table&gt;
                  &lt;tr&gt;
                      &lt;td rowspan ="6"&gt;{{ movie_data.picture }}&lt;/td&gt;
                      &lt;td&gt; Movie Name: {{movie_data.name}}&lt;/td&gt; 
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt; Release Date: {{movie_data.release_date}}&lt;/td&gt; 
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt; Duration (minutes): {{movie_data.duration}}&lt;/td&gt; 
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt; Director: {{movie_data.director}}&lt;/td&gt; 
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt; Actors: {{movie_data.actors}}&lt;/td&gt; 
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt; Summary: {{movie_data.summary}}&lt;/td&gt; 
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td colspan ="2"&gt; {{movie_data.trailer}} &lt;/td&gt;
                  &lt;/table&gt;
          &lt;/div&gt;      
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>