怎样使SVG中不在出现中文乱码?

iamlearning 2003-09-12 09:05:40
也试了转化为UTF-8格式。但还是不行。我用的浏览器是Adobe SVG Viewer 3.0
...全文
912 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
ghwang 2004-03-23
  • 打赏
  • 举报
回复
在SVG里面用css可以解决,举例如下:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<!-- edited with XML Spy v4.3 U (http://www.xmlspy.com) by LEGO (LEGO) -->
<svg width="50cm" height="25cm" viewBox="0 0 4000 2000" preserveAspectRatio="xMidYMid meet" zoomAndPan="magnify" xmlns="http://www.w3.org/2000/svg">
<defs>
<style type="text/css"><![CDATA[.ch{font-family:'FangSong_GB2312';font-size:40;} ]]></style>
</defs>
<g id="text" class="ch">
<text startOffset="0">
<tspan x="200" y="50">乔双</tspan>
</text>
</g>
</svg>
把它保存为UTF-8编码的SVG文件,就可以显示中文
kernelhao 2004-03-21
  • 打赏
  • 举报
回复
是浏览器的问题。浏览器做的还不是太成熟啊!
hotheartlewis 2004-02-26
  • 打赏
  • 举报
回复
up,我也有与iamlearning同样的问题,望高手解答
孟子E章 2003-09-13
  • 打赏
  • 举报
回复
下面也可
<?xml version="1.0" encoding='utf-16' standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="100%" height="100%">
<defs>
<linearGradient id="meng" x1="0%" y1="100%" x2="0%" y2="0%">
<stop offset="0%" style="stop-color:yellow;stop-opacity:1"/>
<stop offset="50%" style="stop-color:red;stop-opacity:1"/>
<stop offset="100%" style="stop-color:blue;stop-opacity:1"/>
</linearGradient>
</defs>
<text x="150" y="50">孟宪会之精彩世界</text>
<ellipse cx="200" cy="200" rx="80" ry="60" style="fill:url(#meng)"/>
</svg>
孟子E章 2003-09-13
  • 打赏
  • 举报
回复
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="100%" height="100%">
<defs>
<linearGradient id="meng" x1="0%" y1="100%" x2="0%" y2="0%">
<stop offset="0%" style="stop-color:yellow;stop-opacity:1"/>
<stop offset="50%" style="stop-color:red;stop-opacity:1"/>
<stop offset="100%" style="stop-color:blue;stop-opacity:1"/>
</linearGradient>
</defs>
<text x="150" y="50">孟宪会之精彩世界</text>
<ellipse cx="200" cy="200" rx="80" ry="60" style="fill:url(#meng)"/>
</svg>
surfw3 2003-09-13
  • 打赏
  • 举报
回复
svgView是不支持GB2312的。
还是按moonpiazza的方法在Amaya看吧,加不加encoding='utf-8'无所谓。
(我在IE6+svgView3.0下,汉字只能见到方格)
iamlearning 2003-09-13
  • 打赏
  • 举报
回复

我的SVG里的中文汉字是从数据库中取出来的。应该是GB2312编码。

但SVG 中的ENCODING=‘UTF-8’,可能出现乱码的原因就在于此,就是两者的编码不一样。

我该怎样用JAVA语言把GB2312中文字符转化为UTF-8格式呢?

例如 怎样把中文:“宁” 变成“宁”呢?
月光易水 2003-09-12
  • 打赏
  • 举报
回复
文档: utf-8格式
文档头:encoding='utf-8'

win2000+ie6+svgView3.0 测试通过!


:_)

8,906

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧