Skip to content

Instantly share code, notes, and snippets.

@Houdini
Created Apr 5, 2010
Embed
What would you like to do?
#sudo geany /usr/lib/ruby1.9.1/gems/1.9.1/gems/mail-2.1.5.3/lib/mail/patterns.rb
#houdini@mozart:~/RoR/dv-news$ RUBYOPT="-Ku" ruby1.9.1 ./script/rails server
#/usr/lib/ruby1.9.1/gems/1.9.1/gems/mail-2.1.5.3/lib/mail/patterns.rb:27:in `<module:Patterns>': invalid multibyte character #(ArgumentError)
# encoding: binary
module Mail
module Patterns
white_space = %Q|\x9\x20|
text = %Q|\x1-\x8\xB\xC\xE-\x7f|
field_name = %Q|\x21-\x39\x3b-\x7e|
field_body = text
aspecial = %Q|()<>[]:;@\\,."| # RFC5322
tspecial = %Q|()<>@,;:\\"/[]?=| # RFC2045
lwsp = %Q| \t\r\n|
control = %Q|\x00-\x1f\x7f-\xff|
CRLF = /\r\n/
WSP = /[#{white_space}]/
FWS = /#{CRLF}#{WSP}*/
TEXT = /[#{text}]/ # + obs-text
FIELD_NAME = /[#{field_name}]+/
FIELD_BODY = /[#{field_body}]+/
FIELD_LINE = /^[#{field_name}]+:\s*[#{field_body}]+$/
HEADER_LINE = /^([#{field_name}]+:\s*[#{field_body}]+)/
# CONTROL_CHAR = /[#{control}]/n
# ATOM_UNSAFE = /[#{Regexp.quote aspecial}#{control}#{lwsp}]/n
# PHRASE_UNSAFE = /[#{Regexp.quote aspecial}#{control}]/n
# TOKEN_UNSAFE = /[#{Regexp.quote tspecial}#{control}#{lwsp}]/n
CONTROL_CHAR = /[#{control}]/u
ATOM_UNSAFE = /[#{Regexp.quote aspecial}#{control}#{lwsp}]/u
PHRASE_UNSAFE = /[#{Regexp.quote aspecial}#{control}]/u
TOKEN_UNSAFE = /[#{Regexp.quote tspecial}#{control}#{lwsp}]/u
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment