【发布时间】:2016-03-24 07:19:10
【问题描述】:
我在 IPython 笔记本中使用西里尔符号。当我在 ML Studio 工作时,它工作得很好。
但是当我下载笔记本并打开它们时(例如在 http://try.jupyter.org 上),我看到了奇怪的字符。
坏笔记本(在 Azure ML Studio 上创建):
{"nbformat_minor": 0, "cells": [{"source": "\u00d1\u0082\u00d0\u00b5\u00d1\u0081\u00d1\u0082", "cell_type": "markdown", "metadata": {"collapsed": true}}], "nbformat": 4, "metadata": {"kernelspec": {"display_name": "Python 2", "name": "python2", "language": "python"}, "language_info": {"mimetype": "text/x-python", "nbconvert_exporter": "python", "version": "2.7.11", "name": "python", "file_extension": ".py", "pygments_lexer": "ipython2", "codemirror_mode": {"version": 2, "name": "ipython"}}}}
$ file bad.ipynb
bad.ipynb: ASCII text, with very long lines, with no line terminators
“好”版本,创建于http://try.jupyter.org:
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"тест"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.10"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
$ file good.ipynb
good.ipynb: UTF-8 Unicode text
【问题讨论】:
-
问题在于编码。你看“тест”不是ascii。因此,Json 解析器将它们转换为 Unicode。您需要知道编码才能获得真实的内容。
-
是的,我明白为什么会发生这种情况,但我不明白如何解决这个问题。
标签: azure encoding jupyter-notebook azure-machine-learning-studio