=== modified file 'uc_cart/uc_cart.module'
--- uc_cart/uc_cart.module	2009-02-18 23:08:59 +0000
+++ uc_cart/uc_cart.module	2009-07-04 07:46:24 +0000
@@ -1773,6 +1773,9 @@
         // Default to the first part of the e-mail address.
         $name = substr($order->primary_email, 0, strpos($order->primary_email, '@'));
 
+        // Remove possible illegal characters.
+        $name = preg_replace('/[^A-Za-z0-9_.-]/', '', $name);
+        
         // Trim that value for spaces and length.
         $name = trim(substr($name, 0, USERNAME_MAX_LENGTH));
 

