2

So this really has me knocking my head against the wall. I have some XML:

  <trans-unit id="4" translate="yes" xml:space="preserve">
    <source xml:lang="en-US">Customize Forecast (Outstanding) by Customer Detail</source>
    <target>Настроить просроченный прогноз по клиентам (подробно)</target>
  </trans-unit>
  <trans-unit id="5" translate="yes" xml:space="preserve">
    <source xml:lang="en-US">Posting Period</source>
    <target>Период разнесения</target>
  </trans-unit>

I want to extract the Russian text to a file. I load the XML into [xml]$mf and do:

$mf.xliff.file.body.trans-unit.target

Trouble is that that renders as:

Выполнена ÑÐ¸Ð½Ñ…Ñ€Ð¾Ð½Ð¸Ð·Ð°Ñ†Ð¸Ñ Ñервера машин вложенного ÑпиÑка Файл PDF Полный CSV-ÑкÑпорт Ð´Ð»Ñ Ð´Ð°Ð½Ð½Ñ‹Ñ… учета {1} ÐšÐ°Ñ‚ÐµÐ³Ð¾Ñ€Ð¸Ñ Ð±ÑŽÐ´Ð¶ÐµÑ‚Ð° Показать Ñтроки Ð’Ñ‹Ð±Ñ€Ð°Ð½Ð½Ð°Ñ ÑƒÑлуга FedEx предуÑматривает только один пакет на отгрузку. ЕÑли заказ Ñодержит неÑÐºÐ¾Ð»Ñ ŒÐºÐ¾ пакетов, оформите каждый пакет как отдельную отгрузку. Закрыта - потерÑна

Which isn't very helpful. I've been googling this for an hour and I'm clearly missing something fairly obvious.

2
[xml]$mf = gc .\testxml.txt -Encoding UTF8
$mf.xliff.file.body.'trans-unit'.target | Out-File c:\path\output.txt -Encoding UTF8
1
  • That's it, seems I was approaching the problem from the wrong end. – Dan Apr 25 '14 at 11:21
0

Try this

[xml]$mf=Get-Content -Encoding UTF8 file.xml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.