Hello again. I've got another question using the api:
One of the params my api receives is the binary representation of an hexadecimal value (the info hash), this parmeter arrives spilled to the $params array.
Diving down the debug, I found that the responsible is getGPCVal method in WebRequest.php, which makes the string go through $data = $wgContLang->checkTitleEncoding( $data ); [l.340] and $data = $this->normalizeUnicode( $data ); [l.343] being therefore altered twice.
I don't know much of Unicode normalization, but I do understand the problem here is it shouldn't be applied on binary data... integer type won't do though, and there is not much more choice... or maybe api types can be extended?
I'm curious about checkTitleEncoding on the other hand. What is it meant for? Could I be lacking mb_check_encoding function and that's why it falls back to 8bit encoding?
I can always use good old $_GET, but I feel I'd rather not. Is it really problematic?
Thanks in advance for any ideas. Numerico
On Mon, Jan 7, 2013 at 5:10 PM, webmaster@numerica.cl wrote:
Hello again. I've got another question using the api:
One of the params my api receives is the binary representation of an hexadecimal value (the info hash),
Why not pass the hex representation, or base36, like list=allimages does for its sha1 parameter? MediaWiki isn't really geared towards taking arbitrary binary data in GET/POST parameters.
Unfortunately I don't have control over the client side. So indeed it would be to force the api to create new types, not something that could be done in an extension anyway... However, $_GET does work. I remember however having read that this wasn't adviced but can't find where or why. I imagine it can be because of the risk of not going through xss filtering etc. But in case there is no such risk (i never return user input) it may be just ok?
Greetings
On 07.01.2013 22:42, Brad Jorsch wrote:
On Mon, Jan 7, 2013 at 5:10 PM, webmaster@numerica.cl wrote:
Hello again. I've got another question using the api:
One of the params my api receives is the binary representation of an hexadecimal value (the info hash),
Why not pass the hex representation, or base36, like list=allimages does for its sha1 parameter? MediaWiki isn't really geared towards taking arbitrary binary data in GET/POST parameters.
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
mediawiki-api@lists.wikimedia.org