prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  UnicodeEncodeError when the prompt string contains non ascii characters.
  The call prompt fails, if the template settings contains non-ASCII characters.
  
  cookiecutter.json example:
  
  ```
  {
          "full_name": "Jindřich Smitka",
          ...
  }
  ```
  
  
  </issue>
  <code>
  [start of cookiecutter/prompt.py]
  1 #!/usr/bin/env python
  2 # -*- coding: utf-8 -*-
  3 
  4 """
  5 cookiecutter.prompt
  6 ---------------------
  7 
  8 Functions for prompting the user for project info.
  9 """
  10 
  11 import sys
  12 
  13 PY3 = sys.version > '3'
  14 if PY3:
  15     iteritems = lambda d: iter(d.items())
  16 else:
  17     input = raw_input
  18     iteritems = lambda d: d.iteritems()
  19 
  20 def prompt_for_config(context):
  21     """
  22     Prompts the user to enter new config, using context as a source for the
  23     field names and sample values.
  24     """
  25     cookiecutter_dict = {}
  26     
  27     for key, val in iteritems(context['cookiecutter']):
  28         prompt = "{0} (default is \"{1}\")? ".format(key, val)
  29         new_val = input(prompt)
  30         new_val = new_val.strip()
  31 
  32         if new_val == '':
  33             new_val = val
  34         
  35         if PY3:
  36             cookiecutter_dict[key] = new_val
  37         else:
  38             cookiecutter_dict[key] = new_val.decode('utf-8')
  39     return cookiecutter_dict
  40 
  41 
  42 def query_yes_no(question, default="yes"):
  43     """
  44     Ask a yes/no question via `raw_input()` and return their answer.
  45 
  46     :param question: A string that is presented to the user.
  47     :param default: The presumed answer if the user just hits <Enter>.
  48         It must be "yes" (the default), "no" or None (meaning
  49         an answer is required of the user).
  50 
  51     The "answer" return value is one of "yes" or "no".
  52 
  53     Adapted from
  54     http://stackoverflow.com/questions/3041986/python-command-line-yes-no-input
  55     http://code.activestate.com/recipes/577058/
  56 
  57     """
  58     valid = {"yes": True, "y": True, "ye": True, "no": False, "n": False}
  59     if default is None:
  60         prompt = " [y/n] "
  61     elif default == "yes":
  62         prompt = " [Y/n] "
  63     elif default == "no":
  64         prompt = " [y/N] "
  65     else:
  66         raise ValueError("invalid default answer: '%s'" % default)
  67 
  68     while True:
  69         sys.stdout.write(question + prompt)
  70         choice = input().lower()
  71 
  72         if default is not None and choice == '':
  73             return valid[default]
  74         elif choice in valid:
  75             return valid[choice]
  76         else:
  77             sys.stdout.write("Please respond with 'yes' or 'no' "
  78                              "(or 'y' or 'n').\n")
  79
  [end of cookiecutter/prompt.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/cookiecutter/prompt.py b/cookiecutter/prompt.py
  --- a/cookiecutter/prompt.py
  +++ b/cookiecutter/prompt.py
  @@ -23,15 +23,15 @@
       field names and sample values.
       """
       cookiecutter_dict = {}
  -    
  +
       for key, val in iteritems(context['cookiecutter']):
  -        prompt = "{0} (default is \"{1}\")? ".format(key, val)
  -        new_val = input(prompt)
  +        prompt = u"{0} (default is \"{1}\")? ".format(key, val)
  +        new_val = input(prompt.encode('utf-8'))
           new_val = new_val.strip()
   
           if new_val == '':
               new_val = val
  -        
  +
           if PY3:
               cookiecutter_dict[key] = new_val
           else:
  
verification_info: {"golden_diff": "diff --git a/cookiecutter/prompt.py b/cookiecutter/prompt.py\n--- a/cookiecutter/prompt.py\n+++ b/cookiecutter/prompt.py\n@@ -23,15 +23,15 @@\n     field names and sample values.\n     \"\"\"\n     cookiecutter_dict = {}\n-    \n+\n     for key, val in iteritems(context['cookiecutter']):\n-        prompt = \"{0} (default is \\\"{1}\\\")? \".format(key, val)\n-        new_val = input(prompt)\n+        prompt = u\"{0} (default is \\\"{1}\\\")? \".format(key, val)\n+        new_val = input(prompt.encode('utf-8'))\n         new_val = new_val.strip()\n \n         if new_val == '':\n             new_val = val\n-        \n+\n         if PY3:\n             cookiecutter_dict[key] = new_val\n         else:\n", "issue": "UnicodeEncodeError when the prompt string contains non ascii characters.\nThe call prompt fails, if the template settings contains non-ASCII characters.\n\ncookiecutter.json example:\n\n```\n{\n        \"full_name\": \"Jind\u0159ich Smitka\",\n        ...\n}\n```\n\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\ncookiecutter.prompt\n---------------------\n\nFunctions for prompting the user for project info.\n\"\"\"\n\nimport sys\n\nPY3 = sys.version > '3'\nif PY3:\n    iteritems = lambda d: iter(d.items())\nelse:\n    input = raw_input\n    iteritems = lambda d: d.iteritems()\n\ndef prompt_for_config(context):\n    \"\"\"\n    Prompts the user to enter new config, using context as a source for the\n    field names and sample values.\n    \"\"\"\n    cookiecutter_dict = {}\n    \n    for key, val in iteritems(context['cookiecutter']):\n        prompt = \"{0} (default is \\\"{1}\\\")? \".format(key, val)\n        new_val = input(prompt)\n        new_val = new_val.strip()\n\n        if new_val == '':\n            new_val = val\n        \n        if PY3:\n            cookiecutter_dict[key] = new_val\n        else:\n            cookiecutter_dict[key] = new_val.decode('utf-8')\n    return cookiecutter_dict\n\n\ndef query_yes_no(question, default=\"yes\"):\n    \"\"\"\n    Ask a yes/no question via `raw_input()` and return their answer.\n\n    :param question: A string that is presented to the user.\n    :param default: The presumed answer if the user just hits <Enter>.\n        It must be \"yes\" (the default), \"no\" or None (meaning\n        an answer is required of the user).\n\n    The \"answer\" return value is one of \"yes\" or \"no\".\n\n    Adapted from\n    http://stackoverflow.com/questions/3041986/python-command-line-yes-no-input\n    http://code.activestate.com/recipes/577058/\n\n    \"\"\"\n    valid = {\"yes\": True, \"y\": True, \"ye\": True, \"no\": False, \"n\": False}\n    if default is None:\n        prompt = \" [y/n] \"\n    elif default == \"yes\":\n        prompt = \" [Y/n] \"\n    elif default == \"no\":\n        prompt = \" [y/N] \"\n    else:\n        raise ValueError(\"invalid default answer: '%s'\" % default)\n\n    while True:\n        sys.stdout.write(question + prompt)\n        choice = input().lower()\n\n        if default is not None and choice == '':\n            return valid[default]\n        elif choice in valid:\n            return valid[choice]\n        else:\n            sys.stdout.write(\"Please respond with 'yes' or 'no' \"\n                             \"(or 'y' or 'n').\\n\")\n", "path": "cookiecutter/prompt.py"}]}