Community discussions

MikroTik App
 
centsi
newbie
Topic Author
Posts: 33
Joined: Wed Dec 13, 2006 2:07 pm
Location: Spain

Character set

Fri Mar 08, 2013 5:57 pm

Hi, I am using the API with the perl interface that is linked to from the API page of the wiki and connecting to a postgresql database all with encoding utf8.

I have a script that checks through access list entries and we have a customer (maybe more than one) who's name contains an ñ (Spanish eñe). Unicode 0241 in case people can't see that character and 0xc3b1 in utf8.

Unfortunately the encoding for that letter is chucked out by Postgresql as not being utf8. If I try to print it, it comes out as �, which doesn't correspond to any wide byte character encoding that I can find.

I've attempted getting perl to convert that text in as many ways and different source character sets as I can think of and nothing works.

So, does anyone know what character set RouterOS uses, or is this a bug of some sort??

Thanks - Lawrence
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: Character set

Fri Mar 08, 2013 6:50 pm

RouterOS, or rather, Winbox, uses whatever charset you have for "non Unicode applications" (i.e. it's never UTF-8 or a wide charset; it's an ANSI charset of some sort). Your language setting can be seen at "Control Panel > Region (and Language settings) > Administrative".

I don't know of a GUI in Windows where you can find the charset associated with that language, but in Perl, I think you may be able to get the OS' charset using POSIX::setlocale.

Whatever the case, you'll also need a way to convert that charset to UTF-8. Also, whenever you need to query the router, you'd have to convert UTF-8 back to that charset. Alternatively, you could use Perl to write all RouterOS data in UTF-8... but then, it's going to look like gibberish when seen from Winbox.
 
centsi
newbie
Topic Author
Posts: 33
Joined: Wed Dec 13, 2006 2:07 pm
Location: Spain

Re: Character set

Mon Mar 11, 2013 9:32 am

Thanks for the info, hopefully I'll be able to take it from here.

L

Who is online

Users browsing this forum: No registered users and 21 guests