api Does not support Arabic !!

When Add USER by writing pppoe appear incorrectly with it appear correctly in WINBOX
I think that the error in this code

function encode_length($length) {
if ($length < 0xe3) {
$length = chr($length);

} 


else{

}
return $length; 
}

Technically, the API protocol sends and receives raw data (bytes), without charset directions, while Winbox uses your OS’ locale charset (IIRC, it’s windows-1252 for Arabic) when rendering those same raw bytes. No API client can know your data’s original charset automatically, though they may try using your computer’s local charset (if they can access it; PHP can’t).

The PHP API client from my signature can optionally be told your locale charset vs. your PHP charset, and convert between the two.

See this page in its wiki for details.

If this thing is impossible?

The only (sort of) impossible thing is for PHP to automatically know your charset.

If you tell it explicitly what your charset is, it is possible for PHP to convert from that charset to whatever charset you need to display on your web page.



Charsets are difficult to explain… Just… try the code from the link above, but replace “windows-1251” with “windows-1252”, and the Cyrillic stuff with Arabic stuff. You’ll probably figure it out once you see the text on screen.




winbox accept arabic but api dont accept !

OK, the charset is windows-1256 (I looked it up…). But other than that, everything else is as I said. Observe:
arabicTest.png

I want use class routeros_api not this class

OK, previously I didn’t want to ask, because I thought I know the answer, but now that you insist, I MUST ask…

Why?

I want to use the Arabic language with Mikrotik

No, I get that.

I mean why do you want to “use class routeros_api not this class”? What’s wrong with “this class”?

This is the class does not work on some versions of PHP

It doesn’t work on 5.2 and earlier, yes.

But do you need to support that? Even 5.3 is already EOL-ed, and that is supported.

Or are you talking about some other sort of “version”? What issues with what version are you talking about?

The problem I’ve built a complete script of the class and during that difficult to change

If you have the code in a repository of some sort (say, GitHub or even a private BitBucket Git repository), I’m willing to send you a pull request with the entire thing changed to that class. Just send me the repo URL.

Alternatively, just try to see if you can change it yourself, and let me help with anything that you can’t figure out the equivalent of. I promise you it’s not as difficult as it may seem.

this is my system api

Cool cool.

Code please? (repo, archive… your call; I prefer repo, but whatever…)

Too many files and I do not know that I deal with this the class if you want to later development

Repositories and archives don’t care. Either will work just fine even with thousands of files.

I’m not sure I understand what you’re saying here.

If you mean “in case I stop developing the class” - the routeros_api class is already kind of non-developed, and you’re working with it, so that’s kind of a moot point… I mean, all contributions post it’s original version have been minor contributions by people who refuse to let it die. Hell, my API client started exactly after I tried to patch the routeros_api class with tag support, but I decided to let it die instead.

If you mean you’re not sure whether you’ll “like using it” after I do the translation for you… Well, like I said, you could try doing the translation yourself - to practice, and get more comfortable with the client. I’m here to help if you get stuck with that too.

And feel free to tell me if something looks illogical, and how would you’ve preferred it be done instead. But before you say “I like everything exactly as it is being done now”, keep it mind many more people don’t, as evidenced by many other forum topics, so there’s this balanced to be struck, so that in the end, the most stuff can be used by the most people in the most elegant fashion.

I do not understand English very well, but Mavhmth Will this stop the use of the class

And I don’t understand Arabic at all, so with that in mind…

Who is Mavhmth?