Skip to content

Problem with Array of Strings #1

@rschittenhelm

Description

@rschittenhelm
var xml = js2xml.convert({message:'Hi',values:['a','b','c']});
console.log(util.inspect(xml))

should give something like this:

'<?xml version=\'1.0\' encoding=\'utf-8\'?><message>Hi</message><values>a</values><values>b</values><values>c</values>'

but returns the following:

'<?xml version=\'1.0\' encoding=\'utf-8\'?><message>Hi</message><values>a\u001b[1ma\u001b[22m\u001b[4ma\u001b[24m\u001b[3ma\u001b[23m\u001b[7ma\u001b[27m\u001b[90ma\u001b[39m\u001b[30ma\u001b[39m\u001b[33ma\u001b[39m\u001b[31ma\u001b[39m\u001b[32ma\u001b[39m\u001b[34ma\u001b[39m\u001b[37ma\u001b[39m\u001b[36ma\u001b[39m\u001b[35ma\u001b[39m\u001b[31ma\u001b[39maa̰̲̲̳̤̲̻̤̲̠͔̟̞̘ͧ́̐̓̋͌͐́̿͜ͅa</values><values>b\u001b[1mb\u001b[22m\u001b[4mb\u001b[24m\u001b[3mb\u001b[23m\u001b[7mb\u001b[27m\u001b[90mb\u001b[39m\u001b[30mb\u001b[39m\u001b[33mb\u001b[39m\u001b[31mb\u001b[39m\u001b[32mb\u001b[39m\u001b[34mb\u001b[39m\u001b[37mb\u001b[39m\u001b[36mb\u001b[39m\u001b[35mb\u001b[39m\u001b[31mb\u001b[39mbb̛̲͔̮̫̰̪̲̘̭̘͔̬͍̣̤̬̤̲̱̪̭̱̼̳͕̰̯͕̫̦̗̣͚͓̩͍ͫ̿̄ͫ̈b</values><values>c\u001b[1mc\u001b[22m\u001b[4mc\u001b[24m\u001b[3mc\u001b[23m\u001b[7mc\u001b[27m\u001b[90mc\u001b[39m\u001b[30mc\u001b[39m\u001b[33mc\u001b[39m\u001b[31mc\u001b[39m\u001b[32mc\u001b[39m\u001b[34mc\u001b[39m\u001b[37mc\u001b[39m\u001b[36mc\u001b[39m\u001b[35mc\u001b[39m\u001b[31mc\u001b[39mcç͔̗͚̩̬̬̥͎̦̞̬͍̳̰̥͕̮̙̥͇͕̦̬̬̱̪̘͓̝̳̯͖̝̘̫͈͌̈̆̇̅̋͊́̓̃ͭ̍ͨͧ̀̋͌̑̚c</values>'

I think the problem is line 30 - you're handling strings like objects

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions