title: Django template 'ascii' codec can't decode byte 0xd8
body: <p>I a template I am trying to link categories to a view that list all content of that category:</p>
  
  <pre><code>&lt;div class="categories"&gt;
  tags:
  {% for c in post.categories.all %}&lt;/div&gt;
  &lt;ul&gt;
  &lt;a class="category" href="{% url "news.views.get_category" c %}"&gt;{{c}}&lt;/a&gt; 
  &lt;/ul&gt;
  {% endfor %}
  &lt;/div&gt;
  </code></pre>
  
  <p>in urls.py I have:</p>
  
  <pre><code>url(r'^(?P&lt;post_cat&gt;[-\w]+)$', 'news.views.get_category'),
  </code></pre>
  
  <p>and in the views:</p>
  
  <pre><code>def get_category(request, post_cat):
  
      """News by Category listing."""
      posts = News.objects.get(categories=post_cat).order_by("-pub_date")
      paginator = Paginator(posts, 10)
  
      try: page = int(request.GET.get("page", '1'))
      except ValueError: page = 1
  
      try:
          posts = paginator.page(page)
      except (InvalidPage, EmptyPage):
          posts = paginator.page(paginator.num_pages)
  
      return render_to_response("news/list-newss_by_category.html",
                                dict(posts=posts, user=request.user))
  </code></pre>
  
  <p>However I get this error:</p>
  
  <pre><code>'ascii' codec can't decode byte 0xd8 in position 12: ordinal not in range(128)
  </code></pre>
  
  <p>(The category string is in Persian) </p>
  
  <p>On the other hand when I just use  </p>
  
  <pre><code>&lt;div class="category"&gt;{{ c }}&lt;/div&gt;
  </code></pre>
  
  <p>instead, the category string renders without issues.</p>
  
  <p>So the problem is how to send the category item as parameter inside the {% url %} tag to the views. </p>
  
  <p>I have tried different things all in vein. Appreciate your hints to resolve this. </p>
  
  <hr>
  
  <p><strong>P.S</strong>. Actually I <strong>solved</strong> the problem by using c.id in the template tag and adjusted urls.py and views.py accordingly. But still keep this question open. Hopefully someone can come up with a better solution. </p>