0

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 )

1
  • What kind of encoding? Character encoding? Commented Jun 20, 2009 at 22:23

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

he ment implementing an Encoding instance for an Encoding that is unsupported by default on ruby
1

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...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.