Method and apparatus for encoding information