Hi,
In message "[ruby-talk:22065] writing UTF-8 strings"
on 01/10/04, Tobias Reif <tobiasreif / pinkjuice.com> writes:
|How can I do this; for example here
|
|---
|print "Content-type: image/svg+xml\n\n"
|
|svg = <<SVG_DOC
|<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
| "http://www.w3.org/TR/SVG/DTD/svg10.dtd">
|<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
| <ellipse cx="10" cy="10" rx="8" ry="6" fill="pink"/>
|</svg>
|SVG_DOC
|
|# how to output the string in UTF-8?
|print svg
Just print. UTF-8 is ASCII compatible, so when you use only ascii
region characters, it's no difference between ASCII string and UTF-8
string. And since Ruby is 8bit clean, when you type in UTF-8 strings
in your script, they just work fine.
matz.