×

Discussion Board

Results 1 to 1 of 1
  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    10

    SVG encoding problem

    I'm developing application for S40 Nokia 6212. I have problem with special czech characters(ěščřžýáíéúů etc.) rendering in SVG. SVG file is encoded in UTF8. Most of these characters are displayed as non-printable.
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN"
    "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
    <svg width="240" height="320" viewBox="0 0 240 320" 
      xmlns="http://www.w3.org/2000/svg" 
      xmlns:xlink="http://www.w3.org/1999/xlink" 
      version="1.1" baseProfile="tiny">
    <text id="text1" x="10" y="50" fill="black" stroke="black" stroke-width="1" font-size="20">žluťoučký kůň</text>
    <text id="text2" x="10" y="80" fill="black" stroke="black" stroke-width="1" font-size="20"></text>
    </svg>
    Sample code.
    Code:
    InputStream is = this.getClass().getResourceAsStream("/file.svg");
    final SVGImage image = (SVGImage) SVGImage.createImage(is, null);
    SVGElement item = (SVGElement) image.getDocument().getElementById("text2");
    item.setTrait("#text", "ěščřžýáíéúů");
    final ScalableGraphics graphics = ScalableGraphics.createInstance();
    display.setCurrent(new Canvas() {
      protected void paint(Graphics g) {
        g.setColor(255, 255, 255);
        g.fillRect(0, 0, getWidth(), getHeight());
        graphics.bindTarget(g);
        image.setViewportWidth(getWidth());
        image.setViewportHeight(getHeight());
        graphics.render(0, 0, image);
        graphics.releaseTarget();
      }
    });
    Output:
    Code:
    ~
    ~lueou<non-printable>k<non-printable> koH
    It doesn't show whole first element text.
    What character endoding should I use? Is it possible to use non ASCII character in tiny SVG files?
    Last edited by valenj4; 2010-04-30 at 11:21.

Similar Threads

  1. 编译Qt样例出错,请看如下
    By TD3 in forum [Archived] Qt General ( Qt技术)
    Replies: 14
    Last Post: 2009-12-24, 03:23
  2. Problem creating svg icon
    By pinhassi in forum Symbian
    Replies: 1
    Last Post: 2008-12-01, 15:58
  3. Problem with the NAC example: svg app icon doesn't always scale
    By svdwal in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2006-07-13, 18:05

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×