Decode text with native2unicode

39 Ansichten (letzte 30 Tage)
Paul Safier
Paul Safier am 1 Nov. 2024 um 22:44
Kommentiert: 埃博拉酱 am 2 Nov. 2024 um 12:43
I have a vector that should be the header names from some data that was obtained via a metrology software program. I believe it corresponds to text values and I'm trying to decode it.
The array is named jnk and is attached.
This attempt gets close, but there are still lots of gibberish characters. Can anyone suggest a better way of doing this? Is there an array of encoding schemes I can loop through until the text displays legibly?
load example.mat
enscheme = 'UTF-16LE';
jnk1 = native2unicode(jnk,enscheme);
disp(jnk1)
Height WLI ᯖ ⍓ □ □ ꋨ⺋欚䃙掱﵊⃍䃠ꬵ咲띵쀖쀀ᯯ㾒쀀 㿰 倀䂔nN 㿰 㿰 um 晦晦晦㿦LARGE LARGE On □ AC160TS 뾯 尩㗏섦뽦尨⽏揖㽦쀀꧴쁀ﲌ犹뛮샠䫐쁘⟷莴ᵣ샠
  2 Kommentare
Walter Roberson
Walter Roberson am 1 Nov. 2024 um 23:52
That's a tough one. I ran through a number of different encodings, but nothing seemed to fit.
Paul Safier
Paul Safier am 2 Nov. 2024 um 0:16
Uh oh, if you're stuck @Walter Roberson it might be curtains for this... :/
It would be nice if there was a list of encoding schemes that I could load into Matlab and loop through every scheme that exists--surely one of them ought to work...

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

埃博拉酱
埃博拉酱 am 2 Nov. 2024 um 1:56
Bearbeitet: 埃博拉酱 am 2 Nov. 2024 um 12:41
I bet this piece of binary can't be plain text encoded. Because there are no encoding methods that take 0 as a valid character, and you have a large string of zeros in your data.
Using UTF16-LE encoding, you can see some valid words, which means that the character component in this data should be UTF16-LE, and the other parts should be binary numeric types.
I write your data to a txt file and open it with VSCode, which also thinks it's a Binray file. If you force it to open with a text editor, VSCode recommends UTF16-LE as well.
  2 Kommentare
Paul Safier
Paul Safier am 2 Nov. 2024 um 2:50
@埃博拉酱 thanks for this info. Is there a way then to decode the binary numerics within the array? Should I determine array elements responsible for the legible words and translate the rest as binary?
埃博拉酱
埃博拉酱 am 2 Nov. 2024 um 12:43
The meaningful words you decode should be all there is to it. Everything else is binary data.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Produkte


Version

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by