可能重复:
在python中转换字符串,如\\ uXXXX
嗨,假设我有字符串
test
'\\u0259'
Run Code Online (Sandbox Code Playgroud)
注意转义反斜杠.
如何将其转换为相应的unicode字符串?
我正在尝试显示这个简单的嵌入式svg:
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Created with SVG-edit - http://svg-edit.googlecode.com/ -->
<g>
<title>Layer 1</title>
<text xml:space="preserve" text-anchor="middle" font-family="serif" font-size="24" id="svg_1" y="125" x="141" stroke-width="0" stroke="#000000" fill="#000000">test</text>
</g>
</svg>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
Chrome显示它,Opera和Firefox没有.有什么遗失的吗?
谢谢你的帮助!
我试图理解 svg 中的 tspan 标签,这里有一些奇怪的东西。看下面的代码,FF 和 Chrome 在 tspans 之间引入了一个水平偏移,但不应该有。
<svg width="625" height="470" xmlns="http://www.w3.org/2000/svg">
<text y="406" x="379" text-anchor="start" stroke-width="0" stroke="#000000" fill="#FF0000">
<tspan x="379" font-weight="normal" font-style="normal" font-size="24" font-family="Arial" fill="#000000" dy="0">a</tspan>
<tspan font-weight="normal" font-style="normal" font-size="24" font-family="Arial" fill="#000000">aa</tspan>
</text>
</svg>
Run Code Online (Sandbox Code Playgroud)
现在转到http://svg-edit.googlecode.com/svn/trunk/editor/svg-editor.html并在 SVG 编辑器(顶部菜单栏中的第二个按钮)中输入代码并应用更改。tspans 之间的偏移不存在!我不知道为什么,HTML、SVG 和 CSS 似乎没有什么特别之处。
希望有人能解开这个谜。它似乎与字体大小有关,更改会更改偏移量。但是,当它设置为 0px 时,文本就会消失。