在批量上传器中正确编码文本
为批量上传器编码字符串的正确方法是什么?目前,当它在我的文本字段中遇到撇号时,它正在退出。
这是一个示例 CSV 文件:
demo,name,message
FALSE,one,"Welcome message"
FALSE,two,"If you’re having a medical emergency"
这是我的bulkloader.yaml:
transformers:
- kind: Message
connector: csv
connector_options:
encoding: utf-8
columns: from_header
property_map:
- property: demo
external_name: demo
import_transform: bool
- property: name
external_name: name
import_transform: str
- property: message
external_name: message
import_transform: str
当我使用这样的示例(文本中带有撇号)运行加载程序时,我会收到以下错误...
UnicodeEncodeError: 'ascii' codec can't对位置 x 处的字符 u'\u2019' 进行编码:序数不在范围内(128)
任何帮助表示赞赏。
What is the proper way to encode strings for the bulk uploader. It is currently bailing out when it runs into an apostrophe inside my text fields.
Here's a sample CSV file:
demo,name,message
FALSE,one,"Welcome message"
FALSE,two,"If you’re having a medical emergency"
Here's my bulkloader.yaml:
transformers:
- kind: Message
connector: csv
connector_options:
encoding: utf-8
columns: from_header
property_map:
- property: demo
external_name: demo
import_transform: bool
- property: name
external_name: name
import_transform: str
- property: message
external_name: message
import_transform: str
When I run the loader with a sample like this (that has apostrophes in the text), I'll get the following error...
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position x: ordinal not in range(128)
Any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
'
不是 ASCII 字符。您应该尝试将属性转换更改为import_transform: unicode
’
isn't an ASCII character. You should try changing the property transform to beimport_transform: unicode