- if ( strpos( $quoted, '.' ) !== false || strpos( $quoted, ',' ) !== false ) {
- $quoted = '"' . $quoted . '"';
+ // Must only be quoted if string does not use =? encoding (T191931)
+ if ( $quoted === $name ) {
+ $quoted = '"' . addslashes( $quoted ) . '"';