prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN 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",
          ...
  }
  ```
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `cookiecutter/prompt.py`
  Content:
  ```
  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 FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
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"}], "after_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 = 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        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"}]}