Skip to content

Commit

Permalink
Merge pull request #7 from seth-macpherson/master
Browse files Browse the repository at this point in the history
Code patch to correct invalid multibyte escape
  • Loading branch information
qoobaa committed Jan 31, 2013
2 parents f44a3d1 + 86f243a commit 1f23988
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/vcard/bnf.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: ascii
# Copyright (C) 2008 Sam Roberts

# This library is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -59,12 +60,14 @@ module Bnf #:nodoc:

# QSAFE-CHAR = WSP / %x21 / %x23-7E / NON-US-ASCII
# ; Any character except CTLs and DQUOTE
QSAFECHAR = /[ \t\x21\x23-\x7e\x80-\xff]/
# set ascii encoding so that multibyte chars can be properly escaped
QSAFECHAR = Regexp.new("[ \t\x21\x23-\x7e\x80-\xff]")
ALL_QSAFECHARS = /\A#{QSAFECHAR}*\z/

# SAFE-CHAR = WSP / %x21 / %x23-2B / %x2D-39 / %x3C-7E / NON-US-ASCII
# ; Any character except CTLs, DQUOTE, ";", ":", ","
SAFECHAR = /[ \t\x21\x23-\x2b\x2d-\x39\x3c-\x7e\x80-\xff]/
# escape character classes then create new Regexp
SAFECHAR = Regexp.new(Regexp.escape("[ \t\x21\x23-\x2b\x2d-\x39\x3c-\x7e\x80-\xff]"))
ALL_SAFECHARS = /\A#{SAFECHAR}*\z/
end
end
2 changes: 1 addition & 1 deletion lib/vcard/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Vcard
VERSION = "0.2.2"
VERSION = "0.2.3"
end

0 comments on commit 1f23988

Please sign in to comment.