prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  UnicodeDecodeError at /rest/v1/recipient_country/
  'ascii' codec can't decode byte 0xc3 in position 7: ordinal not in range(128)
  
  
  </issue>
  <code>
  [start of akvo/rsr/models/country.py]
  1 # -*- coding: utf-8 -*-
  2 
  3 # Akvo RSR is covered by the GNU Affero General Public License.
  4 # See more details in the license.txt file located at the root folder of the Akvo RSR module.
  5 # For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
  6 
  7 
  8 from django.db import models
  9 from django.core.validators import MaxValueValidator, MinValueValidator
  10 from django.utils.translation import ugettext_lazy as _
  11 
  12 from ..fields import ValidXMLCharField
  13 from ..iso3166 import ISO_3166_COUNTRIES, CONTINENTS, COUNTRY_CONTINENTS
  14 
  15 from akvo.codelists import models as codelist_models
  16 from akvo.codelists.store.codelists_v202 import COUNTRY
  17 from akvo.utils import codelist_choices, codelist_value
  18 
  19 
  20 class Country(models.Model):
  21     name = ValidXMLCharField(_(u'country name'), max_length=50, unique=True, db_index=True)
  22     iso_code = ValidXMLCharField(
  23         _(u'ISO 3166 code'), max_length=2, unique=True, db_index=True, choices=ISO_3166_COUNTRIES
  24     )
  25     continent = ValidXMLCharField(_(u'continent name'), max_length=20, db_index=True)
  26     continent_code = ValidXMLCharField(
  27         _(u'continent code'), max_length=2, db_index=True, choices=CONTINENTS
  28     )
  29 
  30     def __unicode__(self):
  31         return self.name
  32 
  33     @classmethod
  34     def fields_from_iso_code(cls, iso_code):
  35         continent_code = COUNTRY_CONTINENTS[iso_code]
  36         name = dict(ISO_3166_COUNTRIES)[iso_code]
  37         continent = dict(CONTINENTS)[continent_code]
  38         return dict(
  39             iso_code=iso_code, name=name, continent=continent, continent_code=continent_code
  40         )
  41 
  42     class Meta:
  43         app_label = 'rsr'
  44         verbose_name = _(u'country')
  45         verbose_name_plural = _(u'countries')
  46         ordering = ['name']
  47 
  48 
  49 class RecipientCountry(models.Model):
  50     project = models.ForeignKey(
  51         'Project', verbose_name=_(u'project'), related_name='recipient_countries'
  52     )
  53     country = ValidXMLCharField(
  54         _(u'recipient country'), blank=True, max_length=2,choices=codelist_choices(COUNTRY, show_code=False),
  55         help_text=_(u'The country that benefits from the project.')
  56     )
  57     percentage = models.DecimalField(
  58         _(u'recipient country percentage'), blank=True, null=True, max_digits=4, decimal_places=1,
  59         validators=[MaxValueValidator(100), MinValueValidator(0)],
  60         help_text=_(u'The percentage of total commitments or total activity budget allocated to '
  61                     u'this country. Content must be a positive decimal number between 0 and 100, '
  62                     u'with no percentage sign. Percentages for all reported countries and regions '
  63                     u'MUST add up to 100%. Use a period to denote decimals.')
  64     )
  65     text = ValidXMLCharField(
  66         _(u'recipient country description'), blank=True, max_length=50,
  67         help_text=_(u'Enter additional information about the recipient country, if necessary.')
  68     )
  69 
  70     def __unicode__(self):
  71         if self.country:
  72             try:
  73                 country_unicode = self.iati_country().name
  74             except (AttributeError, codelist_models.Country.DoesNotExist):
  75                 country_unicode = self.country
  76         else:
  77             country_unicode = u'%s' % _(u'No country specified')
  78 
  79         if self.percentage:
  80             country_unicode += u' (%s%%)' % str(self.percentage)
  81 
  82         return country_unicode
  83 
  84     def iati_country(self):
  85         return codelist_value(codelist_models.Country, self, 'country')
  86 
  87     def iati_country_unicode(self):
  88         return str(self.iati_country())
  89 
  90     class Meta:
  91         app_label = 'rsr'
  92         verbose_name = _(u'recipient country')
  93         verbose_name_plural = _(u'recipient countries')
  94         ordering = ('-percentage', 'country')
  95
  [end of akvo/rsr/models/country.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/akvo/rsr/models/country.py b/akvo/rsr/models/country.py
  --- a/akvo/rsr/models/country.py
  +++ b/akvo/rsr/models/country.py
  @@ -51,7 +51,7 @@
           'Project', verbose_name=_(u'project'), related_name='recipient_countries'
       )
       country = ValidXMLCharField(
  -        _(u'recipient country'), blank=True, max_length=2,choices=codelist_choices(COUNTRY, show_code=False),
  +        _(u'recipient country'), blank=True, max_length=2, choices=codelist_choices(COUNTRY, show_code=False),
           help_text=_(u'The country that benefits from the project.')
       )
       percentage = models.DecimalField(
  @@ -85,7 +85,7 @@
           return codelist_value(codelist_models.Country, self, 'country')
   
       def iati_country_unicode(self):
  -        return str(self.iati_country())
  +        return unicode(self.iati_country())
   
       class Meta:
           app_label = 'rsr'
  
verification_info: {"golden_diff": "diff --git a/akvo/rsr/models/country.py b/akvo/rsr/models/country.py\n--- a/akvo/rsr/models/country.py\n+++ b/akvo/rsr/models/country.py\n@@ -51,7 +51,7 @@\n         'Project', verbose_name=_(u'project'), related_name='recipient_countries'\n     )\n     country = ValidXMLCharField(\n-        _(u'recipient country'), blank=True, max_length=2,choices=codelist_choices(COUNTRY, show_code=False),\n+        _(u'recipient country'), blank=True, max_length=2, choices=codelist_choices(COUNTRY, show_code=False),\n         help_text=_(u'The country that benefits from the project.')\n     )\n     percentage = models.DecimalField(\n@@ -85,7 +85,7 @@\n         return codelist_value(codelist_models.Country, self, 'country')\n \n     def iati_country_unicode(self):\n-        return str(self.iati_country())\n+        return unicode(self.iati_country())\n \n     class Meta:\n         app_label = 'rsr'\n", "issue": "UnicodeDecodeError at /rest/v1/recipient_country/\n'ascii' codec can't decode byte 0xc3 in position 7: ordinal not in range(128)\r\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\n# Akvo RSR is covered by the GNU Affero General Public License.\n# See more details in the license.txt file located at the root folder of the Akvo RSR module.\n# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.\n\n\nfrom django.db import models\nfrom django.core.validators import MaxValueValidator, MinValueValidator\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom ..fields import ValidXMLCharField\nfrom ..iso3166 import ISO_3166_COUNTRIES, CONTINENTS, COUNTRY_CONTINENTS\n\nfrom akvo.codelists import models as codelist_models\nfrom akvo.codelists.store.codelists_v202 import COUNTRY\nfrom akvo.utils import codelist_choices, codelist_value\n\n\nclass Country(models.Model):\n    name = ValidXMLCharField(_(u'country name'), max_length=50, unique=True, db_index=True)\n    iso_code = ValidXMLCharField(\n        _(u'ISO 3166 code'), max_length=2, unique=True, db_index=True, choices=ISO_3166_COUNTRIES\n    )\n    continent = ValidXMLCharField(_(u'continent name'), max_length=20, db_index=True)\n    continent_code = ValidXMLCharField(\n        _(u'continent code'), max_length=2, db_index=True, choices=CONTINENTS\n    )\n\n    def __unicode__(self):\n        return self.name\n\n    @classmethod\n    def fields_from_iso_code(cls, iso_code):\n        continent_code = COUNTRY_CONTINENTS[iso_code]\n        name = dict(ISO_3166_COUNTRIES)[iso_code]\n        continent = dict(CONTINENTS)[continent_code]\n        return dict(\n            iso_code=iso_code, name=name, continent=continent, continent_code=continent_code\n        )\n\n    class Meta:\n        app_label = 'rsr'\n        verbose_name = _(u'country')\n        verbose_name_plural = _(u'countries')\n        ordering = ['name']\n\n\nclass RecipientCountry(models.Model):\n    project = models.ForeignKey(\n        'Project', verbose_name=_(u'project'), related_name='recipient_countries'\n    )\n    country = ValidXMLCharField(\n        _(u'recipient country'), blank=True, max_length=2,choices=codelist_choices(COUNTRY, show_code=False),\n        help_text=_(u'The country that benefits from the project.')\n    )\n    percentage = models.DecimalField(\n        _(u'recipient country percentage'), blank=True, null=True, max_digits=4, decimal_places=1,\n        validators=[MaxValueValidator(100), MinValueValidator(0)],\n        help_text=_(u'The percentage of total commitments or total activity budget allocated to '\n                    u'this country. Content must be a positive decimal number between 0 and 100, '\n                    u'with no percentage sign. Percentages for all reported countries and regions '\n                    u'MUST add up to 100%. Use a period to denote decimals.')\n    )\n    text = ValidXMLCharField(\n        _(u'recipient country description'), blank=True, max_length=50,\n        help_text=_(u'Enter additional information about the recipient country, if necessary.')\n    )\n\n    def __unicode__(self):\n        if self.country:\n            try:\n                country_unicode = self.iati_country().name\n            except (AttributeError, codelist_models.Country.DoesNotExist):\n                country_unicode = self.country\n        else:\n            country_unicode = u'%s' % _(u'No country specified')\n\n        if self.percentage:\n            country_unicode += u' (%s%%)' % str(self.percentage)\n\n        return country_unicode\n\n    def iati_country(self):\n        return codelist_value(codelist_models.Country, self, 'country')\n\n    def iati_country_unicode(self):\n        return str(self.iati_country())\n\n    class Meta:\n        app_label = 'rsr'\n        verbose_name = _(u'recipient country')\n        verbose_name_plural = _(u'recipient countries')\n        ordering = ('-percentage', 'country')\n", "path": "akvo/rsr/models/country.py"}]}