I am working on Greek language integration. I have message in greek language and my issue is to pass this message into url with GSM7 encode.
I try to find GSM7 bit encode and decode in PHP, but I could not find it.
I want to encode "EXETE ΔIAΓPAΦEI EΠITYXΩΣ AΠO TIΣ ΛIΣTEΣ MAΣ" to GSM7 bit encode.
Please help if anyone know..
Related
I have been working on some QR codes, I need to pass an array to the QR with the data but it needs encoding. The data itself is a json_array which is used to generate a PDF.
If I use base64 encoding the QR code is stupidly large, and when using ascii85 it breaks the QR.
Can you let me know of any encoding praticies which would work in the url, the shorted the coding the betetr. qr_generator.php?data={encoded_json_array}
You can try this:
urlencode($string);
It encodes a string to be appended as an url parameter. So if you have an array, try:
urlencode(json_encode($array);
I am getting data from a web API which has a strange encoding. I am using PHP and can't seem to decode input strings. I seem to be having this problem, which explains what's going but doesn't really help me figure out how to fix it.
Can anyone help?
Thanks!
You may want to try analyzing the encoding using something like mb_detect_encoding().
http://www.php.net/mb_detect_encoding
You can use mb_detect_encoding() to detect the encoding of the strings.
If they are not what you are expecting, you can use mb_convert_encoding() to convert to something like UTF-8 or whatever you want.
I have a big problem : I don't have the same result if I do base64_decode($string); in php or if I do Base64.decode(string); in android.
Example :
with this string : WWhiZWWSZpNlaGSTnpljZQ==
In php, result is Yhbee’f“ehd“ž™ce .
In android, the result is Yhbee�f�ehd���ce
I think there is an encoding problem, but I don't know where, the output of my PHP server is ISO-8859-1, I don't find how to tell to Base64.decode to use this type of encoding.
Can you help me please. Thx for answers.
PS : I can't touch the PHP script.
I think this will help you, Don't use .toString() use this instead
var str = "WWhiZWWSZpNlaGSTnpljZQ=="
var decoded = String(Base64.decode(str, Base64.NO_WRAP))
I know this to late to answer :-D
You should try this:
Base64.decode(content.getBytes("ISO-8859-1"), Base64.DEFAULT);
By this You convert the input String content to ISO-8859-1 encoded byte stream that will be decoded from base64.
I think the decode is fine, but Android isn't applying the right encoding (probably utf-8).
Does this content appear on an HTML page? If so, are you properly enforcing the ISO-8859-1 encoding?
Alternatively, you could also switch to UTF-8.
I have a VB6 application that is creating a JSON string and posting it to a website (PHP5). It may look like this:
data=thisisthejsonstringitcontainsthe£hmtlcharacter&code=123&api_key=321
This is an issue because the £ is thought to be the start of a new variable so the json string is being cut.
Does this need to be encoded somehow at the VB source? Or can I do something with this when it arrives at the website? If it needs encoded by VB can anyone suggest a suitable function?
I'm using the application/x-www-form-urlencoded content type when posting.
This might seem far fetched, but have you tried sending £ urlencoded beforehand? being %26pound
If you send url arguments to a webserver, you'll need to urlencode them. That's true for all arguments in formats that don't escape and can contain problematic characters themselves, which includes JSON.
Does anyone know how to properly decode the following string in PHP?
=?iso-8859-1?Q?OLG=20Slots=20at=20Windsor=20=26=20Caesars=20Windsor=20w?=
I tried using
quoted_printable_decode()
but did not produce the desired result.
This string retrieved from an email header. This above string is the "Subject". It appears that email clients (both web-based and applications) are able to decode the string properly.
Thanks for your time!
It is not url_encoded, instead try this :
$subject = '=?iso-8859-1?Q?OLG=20Slots=20at=20Windsor=20=26=20Caesars=20Windsor=20w?=';
echo utf8_decode(imap_utf8($subject));
Manual
The first bit suggests it's encoded in ISO-8859-1, which is, if I'm reading Wikipedia correctly, standard ASCII.
This means that you probably don't need to decode the string, you just need to understand it ;-)
Where did you find it? What do you think it's meaning might be? (eg is it submitted form data, some sort of RPC encoding, something else?)
Thank you! Just seen your edit. Have you tried b64 decoding it? At a guess it's base64 encoded ASCII. Try base64_decode().