puppetlabs/puppet — pull request #1943 by raphink (2013-09-26 12:25:38+00:00)
Title: Force encoding of comment value to ASCII-8BIT

The `comment` field for `user` resources can often contain non-ASCII characters. Unfortunately, Puppet retrieves the existing value (`current_value`) as ASCII-8BIT, but strings containing non-ASCII characters are automatically turned into UTF-8, resulting in a failure to concatenate the strings in `change_to_s`, with messages such as the following in Puppet 3.2.4 with Ruby 1.9.3:

Error: Could not convert change 'comment' to string: incompatible character encodings: ASCII-8BIT and UTF-8
Error: Could not convert change 'comment' to string: incompatible character encodings: ASCII-8BIT and UTF-8
Error: /User[rpinson]: Could not evaluate: Puppet::Util::Log requires a message

which is due to the fact that `current_value` is encoded in ASCII-8BIT, but `newvalue` is in UTF-8 and not "softly" convertible when reaching `change_to_s` in `property.rb`.

In order to allow proper management of non-ASCII characters in the comment field, this PR forces an ASCII-8BIT encoding on the comment property value in the type.