Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
drupal
Commits
79766787
Commit
79766787
authored
Apr 21, 2004
by
Kjartan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Only encode strings that contain non-ASCII characters.
parent
291b56c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
8 deletions
+14
-8
modules/user.module
modules/user.module
+7
-4
modules/user/user.module
modules/user/user.module
+7
-4
No files found.
modules/user.module
View file @
79766787
...
...
@@ -280,6 +280,7 @@ function user_mail_encode($string, $charset = "UTF-8") {
** http://www.rfc-editor.org/rfc/rfc2047.txt
**
** Notes:
** - Only encode strings that contain non-ASCII characters.
** - The chunks come in groupings of 4 bytes when using base64
** encoded.
** - trim() is used to ensure that no extra spacing is added by
...
...
@@ -287,10 +288,12 @@ function user_mail_encode($string, $charset = "UTF-8") {
** - Using \n as the chunk separator may cause problems on some
** systems and may have to be changed to \r\n or \r.
*/
$chunk_size
=
75
-
7
-
strlen
(
$charset
);
$chunk_size
-=
$chunk_size
%
4
;
$string
=
trim
(
chunk_split
(
base64_encode
(
$string
),
$chunk_size
,
"
\n
"
));
$string
=
trim
(
preg_replace
(
'/^(.*)$/m'
,
" =?
$charset
?B?
\\
1?="
,
$string
));
if
(
!
preg_match
(
'/^[\x20-\x7E]*$/'
,
$string
))
{
$chunk_size
=
75
-
7
-
strlen
(
$charset
);
$chunk_size
-=
$chunk_size
%
4
;
$string
=
trim
(
chunk_split
(
base64_encode
(
$string
),
$chunk_size
,
"
\n
"
));
$string
=
trim
(
preg_replace
(
'/^(.*)$/m'
,
" =?
$charset
?B?
\\
1?="
,
$string
));
}
return
$string
;
}
...
...
modules/user/user.module
View file @
79766787
...
...
@@ -280,6 +280,7 @@ function user_mail_encode($string, $charset = "UTF-8") {
** http://www.rfc-editor.org/rfc/rfc2047.txt
**
** Notes:
** - Only encode strings that contain non-ASCII characters.
** - The chunks come in groupings of 4 bytes when using base64
** encoded.
** - trim() is used to ensure that no extra spacing is added by
...
...
@@ -287,10 +288,12 @@ function user_mail_encode($string, $charset = "UTF-8") {
** - Using \n as the chunk separator may cause problems on some
** systems and may have to be changed to \r\n or \r.
*/
$chunk_size
=
75
-
7
-
strlen
(
$charset
);
$chunk_size
-=
$chunk_size
%
4
;
$string
=
trim
(
chunk_split
(
base64_encode
(
$string
),
$chunk_size
,
"
\n
"
));
$string
=
trim
(
preg_replace
(
'/^(.*)$/m'
,
" =?
$charset
?B?
\\
1?="
,
$string
));
if
(
!
preg_match
(
'/^[\x20-\x7E]*$/'
,
$string
))
{
$chunk_size
=
75
-
7
-
strlen
(
$charset
);
$chunk_size
-=
$chunk_size
%
4
;
$string
=
trim
(
chunk_split
(
base64_encode
(
$string
),
$chunk_size
,
"
\n
"
));
$string
=
trim
(
preg_replace
(
'/^(.*)$/m'
,
" =?
$charset
?B?
\\
1?="
,
$string
));
}
return
$string
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment