In Intersystem Cache i export some GLOBALs using
$system.OBJ.Export("GCL.GLB", "C:\GCL.xml")
Now there is a field that is BASE64 encoded, for example the following row:
<Node><Sub>2</Sub>
<DataBase64>AgEDATECAQgBU2luZ2xlBATD+QQEkH4EBCD9BAQcAgIEBQE2RE4CAQIBAgECAQIBYwEJAWFmd2V6
aWcCASoBX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXwIBFQFIb2dlIEhv
bmRzdHJhYXQgMTE1EwE3NDEzIENFLCBERVZFTlRFUgIBBQExQVMFATVBQwYBMzhHQg0BNjM4ODEs
MzU4NjM=
</DataBase64>
</Node>
When i decode the base64 data in UTF-8 i do not get all data, i heard that it needs to be decoded in IBM437 but then i still miss the first 3 fields which should be 3 numbers with a length of 5
Does someone know which encoding is right or how i can see what encoding i need for this?
Thanks
I don't see any issues with this Base64, you have data in $LB format there.
USER>s b64="AgEDATECAQgBU2luZ2xlBATD+QQEkH4EBCD9BAQcAgIEBQE2RE4CAQIBAgECAQIBYwEJAWFmd2V6aWcCASoBX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXwIBFQFIb2dlIEhvbmRzdHJhYXQgMTE1EwE3NDEzIENFLCBERVZFTlRFUgIBBQExQVMFATVBQwYBMzhHQg0BNjM4ODEsMzU4NjM="
USER>s data=$system.Encryption.Base64Decode(b64)
USER>zw data
data=$lb("","1","","Single",63939,32400,64800,540,0,"6DN","","","","","",$lb("afwezig","","________________________________________","","Hoge Hondstraat 115","7413 CE, DEVENTER",""),"1AS","5AC","38GB","63881,35863")
Related
I am trying to solve the problem with chars encoding in api results. I have tried already to convince API provide to add utf-8 definition to header, but without success. So I need to convert result by myself in dart/flutter.
Tried already many things with Utf8Decoder or utf8.encode/decode, but without proper result.
Below example is in Polish. What I should have is:
Czesi walczą z pożarem
What I have in API results is:
Czesi walczÄ z pożarem
How can I decode the string to proper format?
Thanks!
I have a bunch of byte arrays that I have to save in my flutter application.
At the moment I convert those byte arrays to base64, and saving them as a single line string.
Is there any better way to save bytes using shared preferences lib/some other lib?
base64 encode is good start, but it will produce very long string.
How about adding additional process by compress those bytes first using gzip, and then save it on local storage using SharedPreference or Hive
import 'dart:convert';
...
final gZipBytes = gzip.encode(bytesArray);
localStorage.save(key, base64.encode(gZipBytes));
Currently, I'm trying to parse an NSData in my iOS app. Problem is, I can't seem to find a proper hebrew encoding for parsing. I must decode the data using the Windows-1255 encoding (hebrew encoding type for windows) or ISO 8859-8 encoding, or I'll get plain gibberish. The closest I've got to solving the issue was using
CFStringConvertEncodingToNSStringEncoding(CFStringEncodings.ISOLatinHebrew)
yet it throws 'CFStringEncodings' is not convertible to 'CFStringEncoding' (notice Encodings vs Encoding).
What can I do in order to encode the data correctly?
Thanks!
The problem is that CFStringEncodings is an enumeration based on CFIndex
(which in turn is a type alias for Int), whereas CFStringEncoding is a type
alias for UInt32. Therefore you have to convert the .ISOLatinHebrew
value explicitly to a CFStringEncoding:
let cfEnc = CFStringEncodings.ISOLatinHebrew
let enc = CFStringConvertEncodingToNSStringEncoding(CFStringEncoding(cfEnc.rawValue))
Turns out I needed to get my hands a bit dirty.
I saw that CFStringEncodings has a relation to the file CFStringEncodingsExt.h, so I searched the file for some help. Suddenly I came across a huge CF_ENUM that included exactly what I needed- all of the CFStringEncodings by their UInt32 value!
So it has turned out that kCFStringEncodingISOLatinHebrew = 0x0208, /* ISO 8859-8 */
I encourage everyone who is facing this encoding issue to go to that file and search for his needed encoding.
The documentation shows you how to return a base64 version of an image using the "read" or "pick" function, but not for a converted one (i.e. filepicker.covert). Is this possible?
There's not currently a way to do this in one step, but one thing you can do is combine the filepicker.read() and filepicker.convert() calls to first convert the file, then read the contents as base64.
How to determine string encoding in cocoa?
Recently I'm working on a radio player.Sometimes id3 tag text was garbled.
Here is my code:
CFDictionaryRef audioInfoDictionary;
UInt32 size = sizeof(audioInfoDictionary);
result = AudioFileGetProperty(fileID, kAudioFilePropertyInfoDictionary, &size, &audioInfoDictionary);
ID3 info are in audioInfoDictionary. Sometimes the id3 doesn't use utf8 encoding, and title, artist name were garbled.
Is there any way to determine what encoding a string use?
Special thx!
While it's an NSString object, there's no specific encoding since it's guaranteed to represent whatever is put into it using the encoding determined when it was created. See the Working With Encodings section of the docs.
From where are you getting the ID3 tags? The time you "receive" this information is the best time to determine its encoding. See Creating and Initializing Strings and the next few sections (for file and url creation) for a list of initializers. Some of them let you set the encoding and others pass back (by reference) the "best guess" encoding the system determined when creating the string. Look for methods with "usedEncoding:" for the system's reported guess.
All of this really depends on exactly what is handing you that string. Are you reading it from a file (an MP3) or a web service (Internet Radio)? If the latter, the server's response should include the encoding and if that's wrong, there's not much to do but guess.