How to get all the encodings present in your system in Ruby

Overview

We can use the list property of the Encoding class to know the encodings present in our computer system. This property displays a long list of encodings loaded on our computer.

Syntax

Encoding.list

Return value

A list of encodings present in our system is presented.

Code example

puts Encoding.list

Code explanation

Line 1: We list the encodings present in this current system environment using the list property of the Encoding class. We then display the output using the puts functionality.

Free Resources