{"id":864,"date":"2013-11-04T23:17:30","date_gmt":"2013-11-04T14:17:30","guid":{"rendered":"http:\/\/43.203.250.216\/?p=864"},"modified":"2020-12-30T17:26:23","modified_gmt":"2020-12-30T08:26:23","slug":"jinja2%ec%9d%98-unicodedecodeerror","status":"publish","type":"post","link":"https:\/\/litcoder.com\/?p=864","title":{"rendered":"Jinja2\uc758 UnicodeDecodeError"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">App engine\uc744 \uc774\uc6a9\ud558\ub294 project \uc911\uc5d0 Jinja2 template \ubd80\ubd84\uc5d0\uc11c \ub2e4\uc74c\uacfc \uac19\uc774 UnicodeDecodeError\uac00 \ubc1c\uc0dd\ud558\ub294 \ubb38\uc81c\uac00 \uc0dd\uacbc\ub2e4.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Traceback (most recent call last):\n  File \"&lt;&lt;APP_ENGINE>>\/lib\/webapp2-2.5.2\/webapp2.py\", line 1535, in __call__\n    rv = self.handle_exception(request, response, e)\n  File \"&lt;&lt;APP_ENGINE>>\/lib\/webapp2-2.5.2\/webapp2.py\", line 1529, in __call__\n    rv = self.router.dispatch(request, response)\n  File \"&lt;&lt;APP_ENGINE>>\/lib\/webapp2-2.5.2\/webapp2.py\", line 1278, in default_dispatcher\n    return route.handler_adapter(request, response)J\n  File \"&lt;&lt;APP_ENGINE>>\/lib\/webapp2-2.5.2\/webapp2.py\", line 1102, in __call__\n    return handler.dispatch()\n  File \"&lt;&lt;APP_ENGINE>>\/lib\/webapp2-2.5.2\/webapp2.py\", line 572, in dispatch\n    return self.handle_exception(e, self.app.debug)\n  File \"&lt;&lt;APP_ENGINE>>\/lib\/webapp2-2.5.2\/webapp2.py\", line 570, in dispatch\n    return method(*args, **kwargs)\n  File \"&lt;&lt;PROJECT_TOP>>\/main.py\", line 141, in get\n    r = t.render(events)\n  File \"&lt;&lt;APP_ENGINE>>\/lib\/jinja2-2.6\/jinja2\/environment.py\", line 894, in render\n    return self.environment.handle_exception(exc_info, True)\n  File \"&lt;&lt;PROJECT_TOP>>\/templates\/parser.html\", line 21, in top-level template code\n    &lt;td>{{titles[loop.index0]}}&lt;\/td>\nUnicodeDecodeError: 'ascii' codec can't decode byte 0xa1 in position 9: ordinal not in range(128)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"http:\/\/jinja.pocoo.org\/docs\/api\/#unicode\">Jinja2 web page\uc758 \uc124\uba85\ubb38\uc11c<\/a>\uc5d0 \ub530\ub974\uba74, Jinja2\ub294 \ub0b4\ubd80\uc801\uc73c\ub85c Unicode\ub97c \uc0ac\uc6a9\ud558\uae30 \ub54c\ubb38\uc5d0 template\uc5d0\ub294 unicode object\ub97c \ub118\uaca8\uc8fc\uc5b4\uc57c \ud55c\ub2e4\uace0 \uc124\uba85\ud558\uace0 \uc788\ub294\ub370, \ub0b4\uac00 project\uc5d0\uc11c \uc0ac\uc6a9\ud558\ub294 web page\ub294 &nbsp;cp949 encoding\uc744 \uc0ac\uc6a9\ud558\uae30 \ub54c\ubb38\uc5d0 \ubb38\uc81c\uac00 \ubc1c\uc0dd\ud55c\ub2e4.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\ub530\ub77c\uc11c \uc774\uac83\uc740 Jinja2 template\uc73c\ub85c data\ub97c \ub118\uae30\uae30 \uc804\uc5d0 unicode()\ub97c \uc774\uc6a9\ud574\uc11c cpc949\ub97c uinicode\ub85c \ubcc0\ud658\ud55c \uac12\uc744 \ub118\uaca8\uc8fc\uba74 \ud574\uacb0\ud560 \uc218 \uc788\ub2e4. \ub2e4\uc74c\uc740 \uc2e4\uc81c\ub85c \uc218\uc815\ub41c code\ub85c cp949\ub85c encoding\ub41c \ubb38\uc790\uc5f4\uc744 &nbsp;unicode\ub85c \ubcc0\ud658\ud574\uc11c \ucd94\uac00\ud558\ub294 \uac83\uc774\ub2e4.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">titles.append(sch.mTitle) -> titles.append(unicode(sch.mTitle, 'cp949'))<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>App engine\uc744 \uc774\uc6a9\ud558\ub294 project \uc911\uc5d0 Jinja2 template \ubd80\ubd84\uc5d0\uc11c \ub2e4\uc74c\uacfc \uac19\uc774 UnicodeDecodeError\uac00 \ubc1c\uc0dd\ud558\ub294 \ubb38\uc81c\uac00 \uc0dd\uacbc\ub2e4. Jinja2 web page\uc758 \uc124\uba85\ubb38\uc11c\uc5d0 \ub530\ub974\uba74, Jinja2\ub294 \ub0b4\ubd80\uc801\uc73c\ub85c Unicode\ub97c \uc0ac\uc6a9\ud558\uae30 \ub54c\ubb38\uc5d0 template\uc5d0\ub294 unicode object\ub97c \ub118\uaca8\uc8fc\uc5b4\uc57c \ud55c\ub2e4\uace0 \uc124\uba85\ud558\uace0 \uc788\ub294\ub370, \ub0b4\uac00 project\uc5d0\uc11c \uc0ac\uc6a9\ud558\ub294 web page\ub294 &nbsp;cp949 encoding\uc744 \uc0ac\uc6a9\ud558\uae30 \ub54c\ubb38\uc5d0 \ubb38\uc81c\uac00 \ubc1c\uc0dd\ud55c\ub2e4. \ub530\ub77c\uc11c \uc774\uac83\uc740 Jinja2 template\uc73c\ub85c data\ub97c \ub118\uae30\uae30 \uc804\uc5d0 unicode()\ub97c \uc774\uc6a9\ud574\uc11c cpc949\ub97c uinicode\ub85c \ubcc0\ud658\ud55c \uac12\uc744 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[5],"tags":[16,69,105],"class_list":["post-864","post","type-post","status-publish","format-standard","hentry","category-programming","tag-appengine","tag-jinja2","tag-python"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/litcoder.com\/index.php?rest_route=\/wp\/v2\/posts\/864","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/litcoder.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/litcoder.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/litcoder.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/litcoder.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=864"}],"version-history":[{"count":1,"href":"https:\/\/litcoder.com\/index.php?rest_route=\/wp\/v2\/posts\/864\/revisions"}],"predecessor-version":[{"id":2761,"href":"https:\/\/litcoder.com\/index.php?rest_route=\/wp\/v2\/posts\/864\/revisions\/2761"}],"wp:attachment":[{"href":"https:\/\/litcoder.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=864"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/litcoder.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=864"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/litcoder.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=864"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}