+2006-08-17 Wolfgang Sourdeau <WSourdeau@Inverse.CA>
+
+ * JSStringTable.m: properly HTML escape JavaScript inside <script>
+ sections (v4.5.89)
+
2006-07-24 Helge Hess <helge.hess@opengroupware.org>
* WEWeekOverview.m: use -warnWithFormat:, minor code cleanups (v4.5.88)
/* generate response */
+ (void)appendTable:(id)_table withIdentifier:(NSString *)_identifier
+ doEscape:(BOOL)_htmlEscape
toResponse:(WOResponse *)_response
{
NSEnumerator *keys;
value = [value stringByReplacingString:@"\"" withString:@"\\\""];
[_response appendContentString:@" \""];
- [_response appendContentString:key];
+ [_response appendContentHTMLString:key];
[_response appendContentString:@"\": \""];
- [_response appendContentString:value];
+ [_response appendContentHTMLString:value];
[_response appendContentString:@"\""];
}
[_response appendContentString:@"\n};\n"];
if (table != nil) {
[_response appendContentString:@"<script type=\"text/javascript\">\n"];
[[self class] appendTable:table withIdentifier:lidentifier
+ doEscape:YES /* HTML escape */
toResponse:_response];
[_response appendContentString:@"</script>"];
}
return r;
}
- [r setHeader:@"application/x-javascript" forKey:@"content-type"];
+ [r setContentEncoding:NSUTF8StringEncoding];
+ [r setHeader:@"application/x-javascript; charset=utf-8"
+ forKey:@"content-type"];
[r setHeader:etag forKey:@"etag"];
/* check preconditions */
[[JSStringTable class]
appendTable:table withIdentifier:[rq formValueForKey:@"id"]
+ doEscape:NO
toResponse:r];
return r;
}