Skip to content

[Bug] Should force UTF-8 encoding in JsonLogHandler of kafka-fetcher-plugin. #9921

@wu-sheng

Description

@wu-sheng

Search before asking

  • I had searched in the issues and found no similar issues.

Apache SkyWalking Component

OAP server (apache/skywalking)

What happened

    @Override
    protected LogData parseConsumerRecord(ConsumerRecord<String, Bytes> record) throws IOException {
        LogData.Builder logDataBuilder = LogData.newBuilder();
        ProtoBufJsonUtils.fromJSON(new String(record.value().get(), StandardCharsets.UTF_8), logDataBuilder);
        return logDataBuilder.build();
    }

This should be the correct way to decode byte[] from Kafka

What you expected to happen

Some one reported this through QQ discussion group in CN.

The original reported agree to submit this fix after he/she tested, I opened this issue for tracking the progress.

How to reproduce

The current code only supported ascii chars. Chinese chars or others out of ascii would be decoded incorrectly.

Such as "body":{"text":{"text":"\"test\""}} -> "body":{"text":{"text":"\x5C"test\x5C""}}

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Labels

backendOAP backend related.bugSomething isn't working and you are sure it's a bug!high priorityHigh priority issue, blocking next release.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions