表格输入,GAE,错误

Пав*_*ков 6 python unicode google-app-engine

由于某种原因,我在GAE中获得了西里尔符号的奇怪输入.

在本地环境中一切正常,我得到输入字段中的内容self.request.get('').但是在Appspot上,我得到的是"1mxt1czq0snfzq =="或"0ylqtdgb0yi =",而不是俄语单词.

在.py

!/usr/bin/env python
-*- coding: utf-8 -*-
title = self.request.get('title')
Run Code Online (Sandbox Code Playgroud)

在.html

meta charset="utf-8"
input type="text" name="title" id="title"
Run Code Online (Sandbox Code Playgroud)

我被卡住了.

编辑: 是的,它是Base64,你是对的.但为什么GAE使用它呢?在哪里改变它?为什么本地和Appspot中的行为不同?

我以同样的形式尝试将文件传递给BlobHandler

<form class="form-horizontal" action="{{ upload_url }}" method="POST" enctype="multipart/form-data">
  <div class="control-group">
    <label class="control-label" for="title">Title</label>
    <div class="controls">
      <input type="text" name="title" id="title">
    </div>
  </div>
  <div class="control-group">
    <label class="control-label" for="file">Load image</label>
    <div class="controls">
      <input type="file" name="file" id="file" accept='image/*' required="required">
    </div>
  </div>
Run Code Online (Sandbox Code Playgroud)

EDIT2: 是的. https://code.google.com/p/googleappengine/issues/detail?id=2749

看起来像是使用BlobHandler的GAE中的错误.

解决方案:在表单中接受-charset ="utf-8",稍后再尝试.

Пав*_*ков 2

错误: https: //code.google.com/p/googleappengine/issues/detail? id=2749

表单中的accept-charset =“utf-8”不起作用。

解决方案:在app.yaml中添加库

- name: webob
  version: "1.2.3"
Run Code Online (Sandbox Code Playgroud)