× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



:) This is just not an option here - it sounds like a nice way to do it, hey, Java can handle this stuff more easily, I believe, and that's no option, either.

Thanks for the suggestion - someday I may get to take a look at Python.

Cheers
Vern

On 2/27/2013 5:09 PM, John Yeung wrote:
OK, bear with me: You can use iSeriesPython for this.

Assuming you have a faithful byte-for-byte copy of the files in the
IFS, you can open them in Python in binary mode to get a stream of
bytes. Then decode as necessary. For example,

f = open('NotepadUnicode.txt', 'rb')
bytes = f.read()
unicode_data = bytes.decode('utf_16_le')

At that point, unicode_data will be a string of Unicode characters,
which you can then either process directly with Python or encode into
a more favorable encoding and save back to the IFS for something else
to process. For example,

output = unicode_data[1:].encode('utf-8')
f2 = open('UTF8.txt', 'wb')
f2.write(output)

(Note that the [1:] strips off the BOM.)

Seriously, if Python is on the table, give it a try!

http://www.iseriespython.com

John


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.