【问题标题】:Unicode issue with pygithub and djangopygithub 和 django 的 Unicode 问题
【发布时间】:2018-08-06 16:58:04
【问题描述】:

我正在尝试连接到这个组织githubtraining

这是我在views.py上的代码:

def home(request):
    global org
    email=request.GET['email']
    password=request.GET['password']
    g = Github("user", "paswword") 
    org = g.get_organization('githubtraining​')
    list_rep= org.get_repos()
    context = {
        'list_rep': list_rep,
        'org':org
    }

    return render(request, 'Github/repo.html',context)

但每次我尝试渲染视图时都会出现此错误:

UnicodeEncodeError at /auth/

'ascii' codec can't encode character '\u200b' in position 24: ordinal not in range(128)

这是因为我的电话有问题吗?

或者那里还有别的东西?

【问题讨论】:

  • \u200b 是一个零宽度空格,有时会插入unintentionally。您是否对代码进行了任何复制/粘贴?也许检查那个repo.html的内容。

标签: django pygithub


【解决方案1】:

您是否检查了模板Github/repo.html 的编码?

确保您的文本编辑器的文件设置使用的是 unicode。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-02-24
    • 2018-03-13
    • 2014-09-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多