如何在SVG中显示unicode? [英] How to display unicode in SVG?

查看:568
本文介绍了如何在SVG中显示unicode?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在数据库中存储了任何以svg格式存储的信息,如果文本,我将以unicode的形式获取.现在,我需要将所有svg文件正确显示在浏览器中.

I have any information stored in svg format in the database and if it text I'll get it as unicode. Now I need that any svg file will be correctly displayed in browser.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" id="header" 
viewBox="654.0519483 -714.4517 356.4000564 252">
<defs></defs><g id="0" visibility="visible">
<text id="gText_11081308229940" name="-1" x="790.251953" y="-631.9517"  
font="Arial"  rotate="0" horizAnchor="middle" vertAnchor="middle" scale="4,4" width="1"            stroke="0x000000"> 
\u0048\u0045\u004C\u004C\u004F\u0020\u0057\u004F\u0052\u004C\u0044\u0021\u0021\u0021\u0021        </text> 
</g></svg>

尝试此代码时,显示的是unicode,而不是字母.

When I try this code I get displayed unicode instead of letters.

推荐答案

如果您真的想插入Unicode值,而不是只是选择正确的编码并将字符直接放在其中,请像在

If you really want to insert Unicode values rather than just choosing the right encoding and putting the characters directly in there, use entities like you would in any other XML document:

    <text id="gText_11081308229940" name="-1" x="790.251953" y="-631.9517" font="Arial" rotate="0" horizAnchor="middle" vertAnchor="middle" scale="4,4" width="1" stroke="0x000000">&#x0048;&#x0045;&#x004C;&#x004C;&#x004F;&#x0020;&#x0057;&#x004F;&#x0052;&#x004C;&#x0044;&#x0021;&#x0021;&#x0021;&#x0021;</text>

示例.

这篇关于如何在SVG中显示unicode?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆