[bknr-cvs] r2422 - branches/bos/projects/bos/web
ksprotte at common-lisp.net
ksprotte at common-lisp.net
Wed Jan 30 10:58:28 UTC 2008
Author: ksprotte
Date: Wed Jan 30 05:58:28 2008
New Revision: 2422
Modified:
branches/bos/projects/bos/web/kml-handlers.lisp
Log:
kml generation with utf-8 now working
Modified: branches/bos/projects/bos/web/kml-handlers.lisp
==============================================================================
--- branches/bos/projects/bos/web/kml-handlers.lisp (original)
+++ branches/bos/projects/bos/web/kml-handlers.lisp Wed Jan 30 05:58:28 2008
@@ -6,6 +6,12 @@
(defun kml-format-color (color &optional (opacity 255))
(format nil "~2,'0X~{~2,'0X~}" opacity (reverse color)))
+(defun utf8-text (string)
+ ;; cxml::utf8-string-to-rod did not
+ ;; what we want, so we use utf-8-string-to-bytes
+ ;; instead
+ (cxml:text (utf-8-string-to-bytes string)))
+
(defclass contract-kml-handler (object-handler)
())
@@ -18,10 +24,10 @@
(let ((polygon (m2s-polygon-lon-lat (contract-m2s c)))
(name (user-full-name (contract-sponsor c))))
(with-element "Placemark"
- (with-element "name" (text (format nil "~A ~Dm2"
- (if name name "anonymous")
- (length (contract-m2s c)))))
- (with-element "description" (text "a description"))
+ (with-element "name" (utf8-text (format nil "~A ~Dm²"
+ (if name name "anonymous")
+ (length (contract-m2s c)))))
+ (with-element "description" (utf8-text "a description"))
(with-element "Style"
(attribute "id" "#region")
(with-element "LineStyle"
@@ -38,10 +44,10 @@
;; the center contract
(when (eq c contract)
(with-element "Placemark"
- (with-element "name" (text "YOUR M2s !!!"))
- (with-element "description" (text (format nil "~A ~Dm2"
- (if name name "anonymous")
- (length (contract-m2s c)))))
+ (with-element "name" (utf8-text "YOUR m²s!"))
+ (with-element "description" (utf8-text (format nil "~A ~Dm2"
+ (if name name "anonymous")
+ (length (contract-m2s c)))))
(with-element "Point"
(with-element "coordinates"
(text (kml-format-points (list (contract-center-lon-lat c)))))))))))))
More information about the Bknr-cvs
mailing list