diff -Nru /tmp/user/1000/HKqvmD4vLs/doc-base-0.7.23/debian/changelog /tmp/user/1000/yy2Quf5qBK/doc-base-0.7.24/debian/changelog
--- /tmp/user/1000/HKqvmD4vLs/doc-base-0.7.23/debian/changelog	2007-03-30 22:22:46.000000000 +0100
+++ /tmp/user/1000/yy2Quf5qBK/doc-base-0.7.24/debian/changelog	2007-04-09 18:06:37.000000000 +0100
@@ -1,3 +1,18 @@
+doc-base (0.7.24) UNRELEASED; urgency=low
+
+  * Non-maintainer upload, incorporating changes from Ubuntu.
+  * Implement scrollkeeper support; documents will show up in GNOME's 'yelp'
+    help browser (closes: #418412).
+  * Encode characters outside ASCII as numeric character entities rather
+    than outputting them as UTF-8; with a little care, this allows us to
+    avoid the use of Unicode::String. (install-docs is used
+    opportunistically by maintainer scripts without a dependency, so it must
+    behave as if it were Essential and work correctly when unconfigured.)
+  * Bump compat-ver so that installed documentation is re-registered with
+    scrollkeeper.
+
+ -- Sam Morris <sam@robots.org.uk>  Mon,  9 Apr 2007 18:06:15 +0100
+
 doc-base (0.7.23) unstable; urgency=low
 
   * Oops, the previous change caused dhelp warnings about trying to create its
diff -Nru /tmp/user/1000/HKqvmD4vLs/doc-base-0.7.23/debian/control /tmp/user/1000/yy2Quf5qBK/doc-base-0.7.24/debian/control
--- /tmp/user/1000/HKqvmD4vLs/doc-base-0.7.23/debian/control	2007-02-07 21:28:24.000000000 +0000
+++ /tmp/user/1000/yy2Quf5qBK/doc-base-0.7.24/debian/control	2007-04-09 17:56:41.000000000 +0100
@@ -7,7 +7,7 @@
 
 Package: doc-base
 Depends: ${perl:Depends}
-Suggests: dhelp | dwww | doc-central
+Suggests: dhelp | dwww | doc-central, scrollkeeper
 Conflicts: dhelp (<< 0.3.14), dwww (<< 1.9.0)
 Architecture: all
 Description: utilities to manage online documentation
diff -Nru /tmp/user/1000/HKqvmD4vLs/doc-base-0.7.23/debian/dirs /tmp/user/1000/yy2Quf5qBK/doc-base-0.7.24/debian/dirs
--- /tmp/user/1000/HKqvmD4vLs/doc-base-0.7.23/debian/dirs	2007-02-07 21:28:24.000000000 +0000
+++ /tmp/user/1000/yy2Quf5qBK/doc-base-0.7.24/debian/dirs	2007-04-09 17:42:54.000000000 +0100
@@ -1,4 +1,4 @@
 usr/share/lintian/overrides
-usr/share/doc-base
+usr/share/doc-base/data
 usr/sbin
 var/lib/doc-base/info
diff -Nru /tmp/user/1000/HKqvmD4vLs/doc-base-0.7.23/debian/postinst /tmp/user/1000/yy2Quf5qBK/doc-base-0.7.24/debian/postinst
--- /tmp/user/1000/HKqvmD4vLs/doc-base-0.7.23/debian/postinst	2007-02-07 21:28:24.000000000 +0000
+++ /tmp/user/1000/yy2Quf5qBK/doc-base-0.7.24/debian/postinst	2007-04-09 18:05:42.000000000 +0100
@@ -6,7 +6,7 @@
 
 package=doc-base
 # upgrades prior to this version require complete re-registration
-compat_ver=0.7.21
+compat_ver=0.7.24
 # upgrades of the following version requires complete re-registration
 bad_ver=0.7.13
 VERBOSE=
diff -Nru /tmp/user/1000/HKqvmD4vLs/doc-base-0.7.23/debian/rules /tmp/user/1000/yy2Quf5qBK/doc-base-0.7.24/debian/rules
--- /tmp/user/1000/HKqvmD4vLs/doc-base-0.7.23/debian/rules	2007-02-07 21:28:24.000000000 +0000
+++ /tmp/user/1000/yy2Quf5qBK/doc-base-0.7.24/debian/rules	2007-04-09 17:41:18.000000000 +0100
@@ -59,6 +59,7 @@
 	$(install_script) install-docs $(sbindir)/
 	$(install_file) doc-base.desc $(sharedir)/doc-base
 	$(install_file) install-docs.desc $(sharedir)/install-docs-man
+	$(install_file) scrollkeeper.map $(sharedir)/data/
 	$(install_file) debian/lintian-overrides $(lintiandir)/$(package)
 
 	
diff -Nru /tmp/user/1000/HKqvmD4vLs/doc-base-0.7.23/install-docs /tmp/user/1000/yy2Quf5qBK/doc-base-0.7.24/install-docs
--- /tmp/user/1000/HKqvmD4vLs/doc-base-0.7.23/install-docs	2007-03-30 22:16:07.000000000 +0100
+++ /tmp/user/1000/yy2Quf5qBK/doc-base-0.7.24/install-docs	2007-04-09 17:54:50.000000000 +0100
@@ -10,9 +10,14 @@
 # ---beginning-of-configuration-part---
 
 $DATA_DIR = "/var/lib/doc-base/info";
+$omf_locations = "/usr/share/omf";
 
 $dwww_update = "/usr/bin/update-menus";
 $dhelp_parse = "/usr/sbin/dhelp_parse";
+$scrollkeeper_update = "/usr/bin/scrollkeeper-update";
+$scrollkeeper_gen_seriesid = "/usr/bin/scrollkeeper-gen-seriesid";
+$scrollkeeper_map_file = "/usr/share/doc-base/data/scrollkeeper.map";
+
 $do_dwww_update = 1;
 my $warn_nonexistent_files = 0;
 
@@ -128,6 +133,9 @@
     read_status_file(1);
     read_list_file();
 
+    # read in doc-base -> scrollkeeper mappings
+    %mapping = read_map($scrollkeeper_map_file);
+
     # update status
     $status{'Control-File'} = $file;
     $status_changed = 1;
@@ -136,6 +144,7 @@
     # register documents to subsystems
     register_dhelp();
     register_dwww();
+    register_scrollkeeper();
 
     write_list_file();
     write_status_file(); # }}}
@@ -162,7 +171,9 @@
 
     # remove newly created files and unregister from menus
     remove_files();
+    remove_omf_files() if $status{'Scrollkeeper-omf-file'};
     update_dwww_menus() if $status{'Registered-to-dwww'};
+    update_scrollkeeper() if $status{'Registered-to-scrollkeeper'};
 
     # remove data files
     remove_data_files(); # }}}
@@ -561,6 +572,11 @@
   $text =~ s/</&lt;/g;
   $text =~ s/>/&gt;/g;
   $text =~ s/"/&quot;/g;
+  no locale; # always use byte semantics for this regex range
+  # We take gratuitous advantage of the first 256 Unicode codepoints
+  # happening to coincide with ISO-8859-1 so that we can HTML-encode
+  # ISO-8859-1 characters without using any non-pragmatic modules.
+  $text =~ s/([^\0-\x7f])/sprintf('&#%d;', ord $1)/eg;
   return $text;
 } # }}}
 
@@ -618,6 +634,93 @@
 
 # -------------------------------
 
+sub remove_omf_files { # {{{
+  my $omf_file = $status{'Scrollkeeper-omf-file'};
+  my $omf_dir = dirname($omf_file);
+  unlink($omf_file) or die "$omf_file: could not delete file: $!";
+
+  #check to see if the directory is now empty. if so, kill it.
+  opendir(DIR, $omf_dir);
+  if (readdir DIR == 0) {
+    rmdir($omf_dir) or die "$omf_dir: could not delete directory: $!";
+  }
+  closedir DIR;
+} # }}}
+
+sub register_scrollkeeper { # {{{
+  my $document = $$doc_data{'document'};
+  my $format_data;
+  for $format_data (@format_list) {
+    next unless $$format_data{'format'} eq 'html'; # scrollkeeper only understands
+                                                   # docbook and html.
+    my $file = $$format_data{'index'};
+    my $format = $$format_data{'format'};
+    write_omf_file($file,$format);
+    #set status
+    $status{'Registered-to-scrollkeeper'} = 1;
+    $status_changed = 1;
+  }
+  update_scrollkeeper();
+} # }}}
+
+sub update_scrollkeeper { # {{{
+  if (-x $scrollkeeper_update) {
+    print "Executing $scrollkeeper_update\n" if $verbose;
+    if (system("$scrollkeeper_update -q >/dev/null 2>&1") != 0) {
+      warn "warning: error occurred during execution of $scrollkeeper_update\n";
+    }
+  }
+} # }}}
+
+sub write_omf_file { # {{{
+  my ($file, $format) = @_;
+  my $document = $$doc_data{'document'};
+  my $omf_file = "$omf_locations/$document/$document-C.omf";
+  my $date;
+  my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
+  $year += 1900;
+  if ($mday <10) {$mday = "0$mday";}
+  if ($mon <10) {$mon = "0$mon";}
+  $date = "$year-$mon-$mday";
+
+  chomp(my $serial_id = `$scrollkeeper_gen_seriesid`);
+
+  if (! -d "$omf_locations/$document") {
+    mkdir("$omf_locations/$document");
+  }
+
+  open(OMF, ">$omf_file")
+    or die "$omf_file: cannot open OMF file for writing: $!";
+  
+  #now for the boiler plate XML stuff
+  print OMF "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
+  print OMF "<!DOCTYPE omf PUBLIC \"-//OMF//DTD Scrollkeeper OMF Variant V1.0//EN\" \"http://scrollkeeper.sourceforge.net/dtds/scrollkeeper-omf-1.0/scrollkeeper-omf.dtd\">\n";
+  print OMF "<omf>\n\t<resource>\n";
+
+  #now for the dynamic stuff
+  print OMF "\t\t<creator>".&html_encode($$doc_data{'author'}, 1)."</creator>\n";
+  print OMF "\t\t<title>".&html_encode($$doc_data{'title'}, 1)."</title>\n";
+  print OMF "\t\t<date>$date</date>\n";
+  print OMF "\t\t<subject category=\"".map_docbase_to_scrollkeeper($$doc_data{'section'})."\"/>\n";
+  print OMF "\t\t<description>".&html_encode($$doc_data{'abstract'}, 1)."</description>\n";
+  if ($format eq 'html') {
+    print OMF "\t\t<format mime=\"text/html\"/>\n";
+  } 
+  elsif ($format eq 'docbook') {
+    print OMF "\t\t<format mime=\"text/xml\" dtd=\"-//OASIS//DTD DocBook XML V4.1.2//EN\"/>\n";
+  }
+  print OMF "\t\t<identifier url=\"$file\"/>\n";
+  print OMF "\t\t<language code=\"C\"/>\n";
+  print OMF "\t\t<relation seriesid=\"$serial_id\"/>\n";
+
+  #finish the boiler plate
+  print OMF "\t</resource>\n</omf>\n";
+  close(OMF) or die "$omf_file: cannot close OMF file: $!";
+  $status{'Scrollkeeper-omf-file'} = $omf_file;
+} # }}}
+
+# -------------------------------
+
 ##
 ## assuming filehandle IN is the control file, read a section (or
 ## "stanza") of the doc-base control file and adds data in that
@@ -731,6 +834,29 @@
   close($fh);
 } # }}}
 
+# arguments: filename
+# reads a file that looks like:
+# foo: bar
+# returns: hash of lv -> rv
+sub read_map { # {{{
+  my ($file) = @_;
+  my $map;
+  open (MAP, "<$file") or die "Could not open $file: $!";
+  while(<MAP>) {
+          chomp;
+          my ($lv,$rv) = split(/: /);
+          $map{lc($lv)} = $rv;
+  }
+  close(MAP);
+  return %map;
+} # }}}
+
+# arguments: doc-base section
+# returns: scrollkeeper category
+sub map_docbase_to_scrollkeeper { # {{{
+  return $mapping{lc($_[0])};
+} # }}}
+
 
 =head1 BUGS
 
diff -Nru /tmp/user/1000/HKqvmD4vLs/doc-base-0.7.23/scrollkeeper.map /tmp/user/1000/yy2Quf5qBK/doc-base-0.7.24/scrollkeeper.map
--- /tmp/user/1000/HKqvmD4vLs/doc-base-0.7.23/scrollkeeper.map	1970-01-01 01:00:00.000000000 +0100
+++ /tmp/user/1000/yy2Quf5qBK/doc-base-0.7.24/scrollkeeper.map	2007-04-09 17:43:15.000000000 +0100
@@ -0,0 +1,18 @@
+Apps/Databases: Development|Databases
+Apps/Editors: Applications|Text Editors
+Apps/Education: Applications|Education
+Apps/Emulators: Applications|Other
+Apps/Graphics: Applications|Multimedia|Graphics
+Apps/Hamradio: Applications|Other
+Apps/Math: Applications|Scientific|Math
+Apps/Net: Applications|Internet
+Apps/Programming: Development
+Apps/Science: Applications|Scientific
+Apps/Tools: Applications|Utilities
+Apps/Technical: Development
+Apps/Text: Applications|Utilities|Text Utilities
+Apps/Shells: Applications|Other
+Apps/Sound: Applications|Multimedia|Sound
+Apps/Viewers: Applications|Multimedia|Graphics|Viewing
+Apps/System: System|Other
+Debian: General|Linux|Debian
