Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5542] ISO_LATIN_1 instead of CHARSET_ISO_LATIN_1

GitHub Issuen/a
TypeImprovement
Priorityn/a
StatusResolved
ResolutionWon't Fix
Resolution Date2018-01-24T12:13:10.000+0000
Affected Version/sAppcelerator Studio 4.5.0
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsn/a
ReporterDaniel Ethier
AssigneeShak Hossain
Created2018-01-23T16:45:31.000+0000
Updated2018-01-24T12:13:16.000+0000

Description

When using Ti.Codec.decodeString, I used ISO_LATIN_1 as the encoding, instead of the correct CHARSET_ISO_LATIN_1. There was no error, but it did not work correctly. There should either be an error, or it should work the same. This also happens with other encoding constants, like ASCII.

Comments

  1. Mostafizur Rahman 2018-01-24

    Hello [~dethier1958], Thanks for sharing with us. Please provide a full sample test code that regenerates the issue. Better to provide a sample app as an attachment here. We will test the issue in our environment. Also, provide the SDK and CLI version you are testing on. Best
  2. Hans Knöchel 2018-01-24

    I don't exactly see what kind of change the SDK could do to improve this. Ti.Codec.ISO_LATIN_1 will be null, so we could do a null-check for the constant in decodeString but that's really it. It's in the responsibility of the developer to pass the correct encodings / constants to the method, so I'd rather see this as an improvement than being a bug. *EDIT*: Looking at the code, it already falls back to UTF8 if a) the charset attribute is not passed or b) the attribute is passed but null. This is documented [here](http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Codec-method-decodeString) as well: {quote} If charset is specified, it determines the character encoding used to decode the string. Otherwise, UTF-8 is assumed. {quote} Resolving issue as Won't do, I hope you are ok with that!

JSON Source