gpt4 book ai didi

python - 如何显示 copyleft 符号?

转载 作者:行者123 更新时间:2023-11-28 22:53:14 24 4
gpt4 key购买 nike

我使用 Google AppEngine、Python 2.7 和 Jinja2 模板。我试过这个https://en.wikipedia.org/wiki/Copyleft#Symbol来自维基百科。作为 html,它在我的浏览器上打印正常。但是当我将它插入 jinja2 模板并尝试在我的 GoogleAppEngine 应用程序中对其进行测试时,它会出现 500 服务器错误。这是我在日志控制台上获得的堆栈跟踪的屏幕截图:

ERROR    2013-10-27 18:06:45,460 mycs253app.py:245] []

ERROR 2013-10-27 18:06:45,648 webapp2.py:1528] 'utf8' codec can't decode byte 0xa9 in position 1290: invalid start byte

Traceback (most recent call last):

File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1511, in __call__

rv = self.handle_exception(request, response, e)

File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1505, in __call__

rv = self.router.dispatch(request, response)

File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1253, in default_dispatcher

return route.handler_adapter(request, response)

File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1077, in __call__

return handler.dispatch()

File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 547, in dispatch

return self.handle_exception(e, self.app.debug)

File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 545, in dispatch

return method(*args, **kwargs)

File "C:\Users\duck\Documents\GitHub\mycs253app\mycs253app.py", line 294, in get

self.render_front_page(page_no)

File "C:\Users\duck\Documents\GitHub\mycs253app\mycs253app.py", line 289, in render_front_page

self.response.out.write(template.render(page))

File "C:\Program Files (x86)\Google\google_appengine\lib\jinja2-2.6\jinja2\environment.py", line 894, in render

return self.environment.handle_exception(exc_info, True)

File "C:\Users\duck\Documents\GitHub\mycs253app\templates\main.html", line 1, in top-level template code

{% extends "base.html" %}

UnicodeDecodeError: 'utf8' codec can't decode byte 0xa9 in position 1290: invalid start byte

ERROR 2013-10-27 18:06:45,677 wsgi.py:278]

Traceback (most recent call last):

File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 266, in Handle

result = handler(dict(self._environ), self._StartResponse)

File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1519, in __call__

response = self._internal_error(e)

File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1511, in __call__

rv = self.handle_exception(request, response, e)

File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1505, in __call__

rv = self.router.dispatch(request, response)

File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1253, in default_dispatcher

return route.handler_adapter(request, response)

File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1077, in __call__

return handler.dispatch()

File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 547, in dispatch

return self.handle_exception(e, self.app.debug)

File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 545, in dispatch

return method(*args, **kwargs)

File "C:\Users\duck\Documents\GitHub\mycs253app\mycs253app.py", line 294, in get

self.render_front_page(page_no)

File "C:\Users\duck\Documents\GitHub\mycs253app\mycs253app.py", line 289, in render_front_page

self.response.out.write(template.render(page))

File "C:\Program Files (x86)\Google\google_appengine\lib\jinja2-2.6\jinja2\environment.py", line 894, in render

return self.environment.handle_exception(exc_info, True)

File "C:\Users\duck\Documents\GitHub\mycs253app\templates\main.html", line 1, in top-level template code

{% extends "base.html" %}

UnicodeDecodeError: 'utf8' codec can't decode byte 0xa9 in position 1290: invalid start byte

INFO 2013-10-27 23:36:45,926 module.py:608] default: "GET / HTTP/1.1" 500 -

这是导致错误的模板(copyleft 在最后):

<!DOCTYPE html>
<html>
<head>

<link type="text/css" rel="stylesheet" href="/css/main.css" />

<title>My Blog</title>

</head>

<body>

<a href="/" class="main-title">
My Blog
</a>

<div class="login-area">
{% if user %}
<a class="login-link" href="/newpost" >newpost</a>
{{user.username}} (<a class="login-link" href="/logout">logout</a>)
{% else %}
<a class="login-link" href="/login">login</a>
|
<a class="login-link" href="/signup">signup</a>
{% endif %}
</div>

<div id="content">
{% block content %}
{% endblock %}
</div>


<!--Copyleft-->

<div style = "color: #333; font-size: 14px" >

<!--[if lte IE 8]><span style="filter: FlipH; -ms-filter: "FlipH"; display: inline-block;"><![endif]-->
<span style="-moz-transform: scaleX(-1); -o-transform: scaleX(-1); -webkit-transform: scaleX(-1); transform: scaleX(-1); display: inline-block;">
©
</span>
<!--[if lte IE 8]></span><![endif]-->

Chintan Pokhrel

</div>



</body>

</html>

此外,当我尝试打印 ɔ (U+0254) 但没有错误时,它会给出一个 ?(问号)符号。

最佳答案

我建议将模板中的版权符号©替换为©

关于python - 如何显示 copyleft 符号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19621297/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com