The code page of the strings of one byte to a character a TwinCAT system has: its PLC's
STRINGs, the names and comments of its symbols and types, and the strings of its system
service and router, such as its host name, routes and adapters. Windows-1252 unless told
otherwise, with codepage: to ADS.Client, ADS.Discovery and the mix tasks, as Beckhoff's own
libraries read them on Western Windows; a system on Windows of another language has that one's.
Codepagex converts them. yaads has these compiled in:
:ascii, :iso_8859_1, and Windows' code pages of one byte to a character, :windows_874 and
:windows_1250 to :windows_1258. The application adds others in its config, by Codepagex's
aliases or names, and recompiles yaads (mix deps.compile yaads --force):
# config/config.exs
config :yaads, :codepages, [:windows_932, "VENDORS/MICSFT/WINDOWS/CP949"]An encoding Codepagex itself has, as configured for the application, is taken too.
What comes out is UTF-8, always: a byte the code page has no character for is "\uFFFD".
Summary
Functions
The code pages compiled into yaads, by Codepagex's full names.
The code page, if yaads or Codepagex has it; else an ArgumentError that says how to add it.
A string from the code page, in UTF-8.
Windows-1252.
A string in the code page; ArgumentError for one with characters it doesn't have.
Types
Functions
@spec available() :: [String.t()]
The code pages compiled into yaads, by Codepagex's full names.
The code page, if yaads or Codepagex has it; else an ArgumentError that says how to add it.
iex> ADS.Codepage.check!(:windows_1251)
:windows_1251
A string from the code page, in UTF-8.
iex> ADS.Codepage.decode(<<"Gr", 0xFC, 0xDF, "e ", 0x80>>)
"Grüße €"
iex> ADS.Codepage.decode(<<0xC0, 0xE1, 0x98>>, :windows_1251)
"Аб�"
@spec default() :: t()
Windows-1252.
A string in the code page; ArgumentError for one with characters it doesn't have.
iex> ADS.Codepage.encode!("Grüße €")
<<"Gr", 0xFC, 0xDF, "e ", 0x80>>