diff --git a/src/Symfony/Component/Translation/Loader/XliffFileLoader.php b/src/Symfony/Component/Translation/Loader/XliffFileLoader.php
index 4ad35decd1..1c7cba6ee8 100644
--- a/src/Symfony/Component/Translation/Loader/XliffFileLoader.php
+++ b/src/Symfony/Component/Translation/Loader/XliffFileLoader.php
@@ -90,7 +90,7 @@ class XliffFileLoader implements LoaderInterface
$source = isset($attributes['resname']) && $attributes['resname'] ? $attributes['resname'] : $translation->source;
// If the xlf file has another encoding specified, try to convert it because
// simple_xml will always return utf-8 encoded values
- $target = $this->utf8ToCharset((string) (isset($translation->target) ? $translation->target : $source), $encoding);
+ $target = $this->utf8ToCharset((string) (isset($translation->target) ? $translation->target : $translation->source), $encoding);
$catalogue->set((string) $source, $target, $domain);
diff --git a/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php
index dc9a06bcb8..29bec0e612 100644
--- a/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php
+++ b/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php
@@ -66,7 +66,7 @@ class XliffFileLoaderTest extends TestCase
$loader = new XliffFileLoader();
$catalogue = $loader->load(__DIR__.'/../fixtures/resname.xlf', 'en', 'domain1');
- $this->assertEquals(array('foo' => 'bar', 'bar' => 'baz', 'baz' => 'foo'), $catalogue->all('domain1'));
+ $this->assertEquals(array('foo' => 'bar', 'bar' => 'baz', 'baz' => 'foo', 'qux' => 'qux source'), $catalogue->all('domain1'));
}
public function testIncompleteResource()
diff --git a/src/Symfony/Component/Translation/Tests/fixtures/resname.xlf b/src/Symfony/Component/Translation/Tests/fixtures/resname.xlf
index 2df16af942..4fa5c0017e 100644
--- a/src/Symfony/Component/Translation/Tests/fixtures/resname.xlf
+++ b/src/Symfony/Component/Translation/Tests/fixtures/resname.xlf
@@ -14,6 +14,9 @@
baz
foo
+
+ qux source
+