Hack for dealing with ASCII, Latin-1 and UTF-8 character-sets. Other
[irspy-moved-to-github.git] / lib / ZOOM / IRSpy / Utils.pm
index c31d188..cbdb5c8 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Utils.pm,v 1.22 2007-03-01 13:51:18 mike Exp $
+# $Id: Utils.pm,v 1.24 2007-03-01 13:59:45 mike Exp $
 
 package ZOOM::IRSpy::Utils;
 
@@ -10,6 +10,7 @@ use Exporter 'import';
 our @EXPORT_OK = qw(isodate
                    xml_encode 
                    cql_quote
+                   cql_target
                    irspy_xpath_context
                    modify_xml_document
                    bib1_access_point);
@@ -66,11 +67,19 @@ sub cql_quote {
     my($term) = @_;
 
     $term =~ s/([""\\])/\\$1/g;
-    $term = qq["$term"] if $term =~ /\s/;
+    $term = qq["$term"] if $term =~ /[\s""\/]/;
     return $term;
 }
 
 
+# Makes a CQL query that finds a specified target
+sub cql_target {
+    my($host, $port, $db) = @_;
+
+    return "rec.id=" . cql_quote("$host:$port/$db");
+}
+
+
 # PRIVATE to irspy_namespace() and irspy_xpath_context()
 my %_namespaces = (
                   e => 'http://explain.z3950.org/dtd/2.0/',