rludwinowski
rludwinowski

Reputation:

Create own encoding

How can I create my own encoding in Ruby (1.9)? The encoding would be for converting string while reading/writing from/for a file, i.e. generally for manipulating data in nonstandard encoded strings ( http://en.wikipedia.org/wiki/Mazovia_encoding )

Upvotes: 0

Views: 1416

Answers (2)

SztupY
SztupY

Reputation: 10536

I couldn't find any references in the ruby-docs about using proprietary encodings, and the Encoding class doesn't have any initializers (but Encoding.find() can load some of the encodings IConv supports dynamically) Unfortunately afaik Mazovia is unsupported even in iconv, so you're stuck with implementing your own class...

Upvotes: 1

jitter
jitter

Reputation: 54605

To your updated question: At the moment all you can do is write some custom code which handles file reading/writing at byte level and does the needed conversions.


If you refer to how you can use different character encodings in ruby with version 1.9 I point you to

Working with Encodings in Ruby 1.9 and

Understanding M17n

Upvotes: 1

Related Questions