ProtoDef-io / ProtoDef-io/node-protodef

String encoding not working

Open
#139 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
35
Forks
25
Avg merge
4d 3m
Merged PRs (30d)
2

Description

I am trying to encode a utf16 string in protodef but when I do

"string": [
  "pstring", {
    "countType": "u16"
  }
]

it will encode a utf8 string and when I add

"string": [
  "pstring", {
    "countType": "u16",
    "encoding": "utf16"
  }
]

it will just give a validation error

Here is the validation error in case you need it:

{
  "keyword": "enum",
  "dataPath": "",
  "schemaPath": "#/oneOf/0/enum",
  "params": {
    "allowedValues": [
      "native"
    ]
  },
  "message": "should be equal to one of the allowed values",
  "schema": [
    "native"
  ],
  "parentSchema": {
    "enum": [
      "native"
    ]
  },
  "data": [
    "pstring",
    {
      "countType": "u16",
      "encoding": "utf16"
    }
  ]
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the pstring type's validation and encoding handling, using the reported countType and encoding options as search terms. Reproduce the utf16 configuration and validation error, then confirm that the accepted configuration encodes utf16 data as requested.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.