Tag Archives: encoding

Image to base64 encoding issue – PHP

Questions: <?php header(“Content-type: image/jpeg;charset=utf-8′”); $path = ‘example/source.jpg’; $da = file_get_contents($path); $base64 = base64_encode($da); $src = ‘data:image/jpeg;charset=utf-8;base64,’.$base64; echo ‘<img src=”‘.$src.'”>’; ?> php v5.6.2 I tired copying the $src value in debug and pasted in img src value. still its not showing up. what did i missed here?. thanks in advance Answers:

Setting Encoding=“http://www.w3.org/2000/09/xmldsig#base64” to <ds:Object>

Questions: I have problem with DSS ESIG sign (https://github.com/esig/dss) in Java. My code looks like: DSSDocument doc = new InMemoryDocument(textToSign.getBytes(StandardCharsets.UTF_8)); String alias = getNotExpiredAlias(); PrivateKey privateKey = instance.getPrivateKey(alias); DSSPrivateKeyEntry privateKeyEntry = new KSPrivateKeyEntry(new KeyStore.PrivateKeyEntry(privateKey, new Certificate[]{instance.getCertificate(alias)})); XAdESSignatureParameters parameters = createSignatureParameters(privateKeyEntry, cryptoCardProvider.is64bit()); XAdESService service = new XAdESService(new CommonCertificateVerifier()); ToBeSigned dataToSign = service.getDataToSign(doc, parameters); SignatureTokenConnection token =… Read More »

Encoding of Java Array in PHP Array functions

Questions: I have an REST API from PHP as Backend and Java(Android) for application. I have a problem in iterating Arrays coming from HTTP Request from Java. Now, How do i create an array in Java that can read also in PHP. The sample snippet of android. private void addVehicle(){ loading.show(); Map<String,String> vehicleData = new… Read More »

UTF-8 encoding CSV file

Questions: I have a CSV file, which using Excel to save as CSV UTF-8 encoded. I have my java code read the file as byte array then String result = new String(b, 0, b.length, “UTF-8″); But somehow the content “Montréal” becomes “Montr?al” when save to DB, what might be the problem? The environment is unix… Read More »

Remove double character encoding

Questions: Using the functions strtr() or str_ireplace() or preg_replace() with array_walk_recursive(), I try to delete the bad character encoding in a multidimensional array, the data are encoding in UTF-8 and comes from a Curl query. I want to remove the double encoding by keeping only the correctly encoded accented character: ã©école => école Array (… Read More »

How to fix encoding

Questions: enter image description hereI am using the code snippet below, but the accent is being printed the wrong way. I already configured JAVA_TOOL_OPTIONS for -Dfile.encoding = UTF-8 and in the eclipse IDE the text file enconding is for UTF-8, but the problem continues. If possible I would like the help of the community to… Read More »