+(defvar gnus-cache-decoded-group-names nil
+ "Alist of original group names and decoded group names.
+Decoding is done according to `gnus-group-name-charset-method-alist'
+or `gnus-group-name-charset-group-alist'.")
+
+(defvar gnus-cache-unified-group-names nil
+ "Alist of unified decoded group names and original group names.
+A group name is decoded according to
+`gnus-group-name-charset-method-alist' or
+`gnus-group-name-charset-group-alist' first, and is encoded and
+decoded again according to `nnmail-pathname-coding-system',
+`file-name-coding-system', or `default-file-name-coding-system'.
+
+It is used when asking for a original group name from a cache
+directory name, in which non-ASCII characters might have been unified
+into the ones of a certain charset particularly if the `utf-8' coding
+system for example was used.")
+
+(defun gnus-cache-decoded-group-name (group)
+ "Return a decoded group name of GROUP."
+ (or (cdr (assoc group gnus-cache-decoded-group-names))
+ (let ((decoded (gnus-group-decoded-name group))
+ (coding (or nnmail-pathname-coding-system
+ (and (boundp 'file-name-coding-system)
+ file-name-coding-system)
+ (and (boundp 'default-file-name-coding-system)
+ default-file-name-coding-system))))
+ (push (cons group decoded) gnus-cache-decoded-group-names)
+ (push (cons (mm-decode-coding-string
+ (mm-encode-coding-string decoded coding)
+ coding)
+ group)
+ gnus-cache-unified-group-names)
+ decoded)))
+