Andrey Pesoshin
Andrey Pesoshin

Reputation: 1186

Charset issues with embedded c++ software

I'm working on a EDK project for Xilinx Spartan 6 fpga. There is a microprocessor system with Microblaze microprocessor implemented in FPGA.

It has a graphical pcore with its own memory space for displaying the text specified in software code executed by Microblaze. Associated ASCII table has 256 characters.

Software fetches the text by RS232 interface. Everything is okay when displaying English text (0-127) cause English characters are the same in quite any charset. But when trying to display Russian, my software cannot associate appropriate ASCII codes with these symbols.

How should I parse text from rs232 to fit 0-255 ASCII intervals?

Upvotes: 1

Views: 253

Answers (1)

Mark Ransom
Mark Ransom

Reputation: 308206

You need to know the character encoding used by your source - RS232 is just a method for moving the bits, it doesn't specify any encoding. Is the source Windows for example? If so, the characters might be either Unicode (UTF-8) or code page 1251. Once you know this encoding you'll need to translate each character, probably using a lookup table of 256 bytes. If the source uses multiple bytes for some characters as UTF-8 does, you'll first need to assemble the bytes into a character code before you can do the lookup.

Upvotes: 2

Related Questions