0

I've been trying to represent binary in Japanese decoding by UTF-8, but still haven't figured out how to do it properly. Here is the codes.

vps_proto = Proto("vps", "VPS Packet")
Name_F = ProtoField.string("Name", "Name")
vps_proto.fields = {Name_F}

function RequestAccountPayloadParse(decoded_buf, pinfo, subtree)
    local PayloadNameRange = decoded_buf(0, 20)
    local PayloadName = PayloadNameRange:string(ENC_UTF_8)

    local payloadPacTree = subtree:add(decoded_buf(), pinfo, subtree)
    payloadPacTree:set_text("Payload")

    payloadPacTree:set_text:add(Name_F, PayloadNameRange, PayloadName)
end

The results showed in wireshark don't contain proper Japanese characters as seen below,

🔻Payload
    Name: \350\213\227\...

which is supposed to be like

🔻Payload
    Name: 山田太郎...

Could you find out the problems for that? Thank you.

1 Answer 1

0

Try replacing these lines:

Name_F = ProtoField.string("Name", "Name")

local PayloadName = PayloadNameRange:string(ENC_UTF_8)

With these:

Name_F = ProtoField.string("vps.Name", "Name", base.UNICODE)

local PayloadName = PayloadNameRange:raw()

See also: wireshark lua string:byte() error

Sign up to request clarification or add additional context in comments.

1 Comment

It worked out with these lines. Thank you very much.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.