diff --git a/lib/modules/Tools.pmod/AutoDoc.pmod/PikeObjects.pmod b/lib/modules/Tools.pmod/AutoDoc.pmod/PikeObjects.pmod
index ca36c3507f2ab772cc1840799af16b479be61379..3edebf1ca702f032d29460c5ee64ddcd8f65f2df 100644
--- a/lib/modules/Tools.pmod/AutoDoc.pmod/PikeObjects.pmod
+++ b/lib/modules/Tools.pmod/AutoDoc.pmod/PikeObjects.pmod
@@ -77,7 +77,19 @@ class IntType {
 
 class StringType {
   inherit Type;
+  string width;
   void create() { ::create("string"); }
+  string print() {
+    if (width)
+      return "string("+width+")";
+    else
+      return "string";
+  }
+  string xml() {
+    if (width)
+      return xmltag("string", xmltag("width",width));
+    return xmltag("string");
+  }
 }
 
 class MixedType {
diff --git a/lib/modules/Tools.pmod/AutoDoc.pmod/PikeParser.pike b/lib/modules/Tools.pmod/AutoDoc.pmod/PikeParser.pike
index bb41b2b908b59b87ceeec07a3f9ea81ef8748c03..6ffca2c5c38e0671a1fbd0d4ead2282982c86e43 100644
--- a/lib/modules/Tools.pmod/AutoDoc.pmod/PikeParser.pike
+++ b/lib/modules/Tools.pmod/AutoDoc.pmod/PikeParser.pike
@@ -322,7 +322,7 @@ StringType parseString() {
   StringType s = StringType();
   if (peekToken() == "(") {
     readToken();
-    eatLiteral();
+    s->width = eatLiteral();
     eat(")");
   }
   return s;
diff --git a/refdoc/xml.txt b/refdoc/xml.txt
index 38d084781c4a8133cb1c0bf217167d3b4ea1380e..38e3c317893414ea0f490763627314cbff07cd92 100644
--- a/refdoc/xml.txt
+++ b/refdoc/xml.txt
@@ -288,7 +288,6 @@ the form <foo/>:
   <float/>
   <mixed/>
   <program/>
-  <string/>
   <void/>
 
 The same goes for mapping, array, function, object, multiset, &c that have 
@@ -324,6 +323,13 @@ int
    
      <int><min>0</min><max>MAX</max></int>
 
+string
+   A string type can have a numerical width value.
+
+     string(8)
+
+     <string><width>8</width></string>
+
 mapping
    The types of the indices and values are given: