[AC-5542] ISO_LATIN_1 instead of CHARSET_ISO_LATIN_1
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | n/a |
Status | Resolved |
Resolution | Won't Fix |
Resolution Date | 2018-01-24T12:13:10.000+0000 |
Affected Version/s | Appcelerator Studio 4.5.0 |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | n/a |
Reporter | Daniel Ethier |
Assignee | Shak Hossain |
Created | 2018-01-23T16:45:31.000+0000 |
Updated | 2018-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.
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
I don't exactly see what kind of change the SDK could do to improve this.
Ti.Codec.ISO_LATIN_1
will benull
, so we could do a null-check for the constant indecodeString
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) thecharset
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 asWon't do
, I hope you are ok with that!