From ca6c394fc8a17bf79519ca467c2ee75947799b7b Mon Sep 17 00:00:00 2001 From: Martin Straub Date: Thu, 18 Dec 2014 14:12:13 +0100 Subject: [PATCH] fix 'invalid multibyte escape' error This fixed my 'invalid multibyte escape' error, like it did in https://github.com/sam-github/vpim/commit/890549b93d2e55e5a43ad3a1dc73c4d061a77cff --- lib/vpim/rfc2425.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/vpim/rfc2425.rb b/lib/vpim/rfc2425.rb index f2a6150..b896d7a 100644 --- a/lib/vpim/rfc2425.rb +++ b/lib/vpim/rfc2425.rb @@ -1,4 +1,4 @@ -# -*- encoding : utf-8 -*- +# -*- encoding : binary -*- =begin Copyright (C) 2008 Sam Roberts @@ -299,11 +299,11 @@ def Vpim.encode_paramtext(value) end def Vpim.encode_paramvalue(value) - case value + case value.force_encoding("BINARY") when %r{\A#{Bnf::SAFECHAR}*\z} - value + value.force_encoding("utf-8") when %r{\A#{Bnf::QSAFECHAR}*\z} - '"' + value + '"' + '"' + value.force_encoding("utf-8") + '"' else raise Vpim::Unencodeable, "param-value #{value.inspect}" end