diff --git a/taglib/riff/rifffile.cpp b/taglib/riff/rifffile.cpp
index 78335690..87b3a0fa 100644
--- a/taglib/riff/rifffile.cpp
+++ b/taglib/riff/rifffile.cpp
@@ -69,6 +69,20 @@ RIFF::File::~File()
   delete d;
 }
 
+bool RIFF::File::isValidChunkName(const ByteVector &name)   // static
+{
+  if(name.size() != 4)
+    return false;
+
+  for(ByteVector::ConstIterator it = name.begin(); it != name.end(); ++it) {
+    const uchar c = static_cast<uchar>(*it);
+    if(c < 32 || 127 < c)
+      return false;
+  }
+
+  return true;
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // protected members
 ////////////////////////////////////////////////////////////////////////////////
@@ -253,22 +267,6 @@ void RIFF::File::removeChunk(const ByteVector &name)
 // private members
 ////////////////////////////////////////////////////////////////////////////////
 
-namespace
-{
-  bool isValidChunkID(const ByteVector &name)
-  {
-    if(name.size() != 4) {
-      return false;
-    }
-    for(int i = 0; i < 4; i++) {
-      if(name[i] < 32 || name[i] > 127) {
-        return false;
-      }
-    }
-    return true;
-  }
-}
-
 void RIFF::File::read()
 {
   d->type = readBlock(4);
@@ -289,7 +287,7 @@ void RIFF::File::read()
     else
       chunkSize = readBlock(4).toUInt32LE(0);
 
-    if(!isValidChunkID(chunkName)) {
+    if(!isValidChunkName(chunkName)) {
       debug("RIFF::File::read() -- Chunk '" + chunkName + "' has invalid ID");
       setValid(false);
       break;
diff --git a/taglib/riff/rifffile.h b/taglib/riff/rifffile.h
index 6c2a9357..2a759f8c 100644
--- a/taglib/riff/rifffile.h
+++ b/taglib/riff/rifffile.h
@@ -51,6 +51,11 @@ namespace TagLib {
        */
       virtual ~File();
 
+      /*!
+       * Returns whether or not \a name is valid as a chunk name.
+       */
+      static bool isValidChunkName(const ByteVector &name);
+
     protected:
 
       File(FileName file, ByteOrder endianness);
diff --git a/taglib/riff/wav/infotag.cpp b/taglib/riff/wav/infotag.cpp
index fac8785c..2530e78f 100644
--- a/taglib/riff/wav/infotag.cpp
+++ b/taglib/riff/wav/infotag.cpp
@@ -26,27 +26,12 @@
 #include <tdebug.h>
 #include <tfile.h>
 
+#include "rifffile.h"
 #include "infotag.h"
 
 using namespace TagLib;
 using namespace RIFF::Info;
 
-namespace 
-{
-  bool isValidChunkID(const ByteVector &name)
-  {
-    if(name.size() != 4)
-      return false;
-
-    for(int i = 0; i < 4; i++) {
-      if(name[i] < 32 || 127 < name[i])
-        return false;
-    }
-
-    return true;
-  }
-}
-
 class RIFF::Info::Tag::TagPrivate
 {
 public:
@@ -197,7 +182,7 @@ String RIFF::Info::Tag::fieldText(const ByteVector &id) const
 void RIFF::Info::Tag::setFieldText(const ByteVector &id, const String &s)
 {
   // id must be four-byte long pure ASCII string.
-  if(!isValidChunkID(id))
+  if(!RIFF::File::isValidChunkName(id))
     return;
 
   if(!s.isEmpty())