~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-06-20 10:46:25 UTC
  • mfrom: (5987.1.1 799212-non-ascii-confs)
  • Revision ID: pqm@pqm.ubuntu.com-20110620104625-ih5t1e8w288pc4l2
(vila) Properly load utf8-encoded config files (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2375
2375
 
2376
2376
        :param str_or_unicode: A string representing the file content. This will
2377
2377
            be utf-8 encoded internally.
2378
 
 
2379
 
        This is for tests and should not be used in production unless a
2380
 
        convincing use case can be demonstrated :)
2381
2378
        """
2382
2379
        if self.is_loaded():
2383
2380
            raise AssertionError('Already loaded: %r' % (self._config_obj,))
2384
 
        co_input = StringIO(str_or_unicode.encode('utf-8'))
 
2381
        co_input = StringIO(str_or_unicode)
2385
2382
        try:
2386
2383
            # The config files are always stored utf8-encoded
2387
2384
            self._config_obj = ConfigObj(co_input, encoding='utf-8')