1e41f4b71Sopenharmony_ci# ArkTS Subsystem Changelog
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci## cl.arkts.1 Behavior of the ignoreBOM Feature of the util.TextDecoder Module Changed
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci**Access Level**
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ciPublic API
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci**Reason for Change**
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ciThe ignoreBOM feature of the **util.TextDecoder** module is not enabled. As a result, data with BOM flags cannot be parsed.
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci**Change Impact**
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ciThis version is compatible with earlier versions and no adaptation is required. The new API can be called to support the ignoreBOM feature.
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci**Start API Level**
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci9
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci**Change Since**
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ciOpenHarmony SDK 5.0.0.35
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci**Key API/Component Changes**
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ciTo ensure version compatibility, the API related to the ignoreBOM feature of the **util.TextDecoder** module is deprecated, and a substitute API is provided.
28e41f4b71Sopenharmony_ci|  Class | Deprecated API | Substitute API |
29e41f4b71Sopenharmony_ci| ------------ | ------------  | ------------ |
30e41f4b71Sopenharmony_ci| util.TextDecoder | decodeWithStream(input: Uint8Array, options?: DecodeWithStreamOptions): string;  | decodeToString(input: Uint8Array, options?: DecodeWithStreamOptions): string;  |
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ci**Adaptation Guide**
33e41f4b71Sopenharmony_ci
34e41f4b71Sopenharmony_ciThe new API provides the same capability as the deprecated one. It is used to decode received data and supports the ignoreBOM feature.
35e41f4b71Sopenharmony_ci
36e41f4b71Sopenharmony_ci```
37e41f4b71Sopenharmony_ciimport { util } from '@kit.ArkTS';
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_cilet textDecoderOptions: util.TextDecoderOptions = {
40e41f4b71Sopenharmony_ci  fatal: false,
41e41f4b71Sopenharmony_ci  ignoreBOM : true
42e41f4b71Sopenharmony_ci}
43e41f4b71Sopenharmony_cilet decodeToStringOptions: util.DecodeToStringOptions = {
44e41f4b71Sopenharmony_ci  stream: false
45e41f4b71Sopenharmony_ci}
46e41f4b71Sopenharmony_cilet textDecoder = util.TextDecoder.create('utf-8', textDecoderOptions);
47e41f4b71Sopenharmony_cilet result = new Uint8Array(6);
48e41f4b71Sopenharmony_ciresult[0] = 0xEF;
49e41f4b71Sopenharmony_ciresult[1] = 0xBB;
50e41f4b71Sopenharmony_ciresult[2] = 0xBF;
51e41f4b71Sopenharmony_ciresult[3] = 0x61;
52e41f4b71Sopenharmony_ciresult[4] = 0x62;
53e41f4b71Sopenharmony_ciresult[5] = 0x63;
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ci// Behavior of decodeWithStream:
56e41f4b71Sopenharmony_ci// let decodeWithStreamOptions: util.DecodeWithStreamOptions = {
57e41f4b71Sopenharmony_ci//   stream: false
58e41f4b71Sopenharmony_ci// }
59e41f4b71Sopenharmony_ci// let retStr = textDecoder.decodeWithStream(result , decodeWithStreamOptions);
60e41f4b71Sopenharmony_ci// console.info("retStr length: " + retStr.length); // retStr length: 4
61e41f4b71Sopenharmony_ci// console.info("retStr value: " + retStr); // retStr value: abc
62e41f4b71Sopenharmony_ci
63e41f4b71Sopenharmony_ci// Behavior of decodeToString:
64e41f4b71Sopenharmony_cilet retStr = textDecoder.decodeToString(result , decodeToStringOptions);
65e41f4b71Sopenharmony_ciconsole.info("retStr length: " + retStr.length); // retStr length: 3
66e41f4b71Sopenharmony_ciconsole.info("retStr value: " + retStr); // retStr value: abc 
67e41f4b71Sopenharmony_ci```
68e41f4b71Sopenharmony_ci
69e41f4b71Sopenharmony_ci## cl.arkts.2 Error Code Indicating Parameter Exceptions for Some APIs of the Base64Helper and StringDecoder Modules Are Changed from undefined to 401
70e41f4b71Sopenharmony_ci
71e41f4b71Sopenharmony_ci**Access Level**
72e41f4b71Sopenharmony_ci
73e41f4b71Sopenharmony_ciPublic API
74e41f4b71Sopenharmony_ci
75e41f4b71Sopenharmony_ci**Reason for Change**
76e41f4b71Sopenharmony_ci
77e41f4b71Sopenharmony_ciThe error code indicating parameter exceptions is 401. In practice, undefined is thrown.
78e41f4b71Sopenharmony_ci
79e41f4b71Sopenharmony_ci**Change Impact**
80e41f4b71Sopenharmony_ci
81e41f4b71Sopenharmony_ciThe error code indicating parameter exceptions is changed from undefined to 401.
82e41f4b71Sopenharmony_ci
83e41f4b71Sopenharmony_ci**Start API Level**
84e41f4b71Sopenharmony_ci
85e41f4b71Sopenharmony_ci|  Class | API |  Start API Level |
86e41f4b71Sopenharmony_ci| ----- | ---- | -------------- |
87e41f4b71Sopenharmony_ci| util.Base64Helper | encodeToStringSync(src: Uint8Array, options?: Type): string;  | 9  |
88e41f4b71Sopenharmony_ci| util.Base64Helper | encode(src: Uint8Array, options?: Type): Promise\<Uint8Array>; | 9  |
89e41f4b71Sopenharmony_ci| util.Base64Helper | encodeSync(src: Uint8Array, options?: Type): Uint8Array;  | 9  |
90e41f4b71Sopenharmony_ci| util.Base64Helper | encodeToString(src: Uint8Array, options?: Type): Promise\<string>; | 9  |
91e41f4b71Sopenharmony_ci| util.Base64Helper | decode(src: Uint8Array \| string, options?: Type): Promise\<Uint8Array>; | 9  |
92e41f4b71Sopenharmony_ci| util.StringDecoder | constructor(encoding?: string);  | 12  |
93e41f4b71Sopenharmony_ci| util.StringDecoder | write(chunk: string \| Uint8Array): string;  | 12  |
94e41f4b71Sopenharmony_ci| util.StringDecoder | end(chunk?: string \| Uint8Array): string;  | 12  |
95e41f4b71Sopenharmony_ci
96e41f4b71Sopenharmony_ci**Change Since**
97e41f4b71Sopenharmony_ci
98e41f4b71Sopenharmony_ciOpenHarmony SDK 5.0.0.35
99e41f4b71Sopenharmony_ci
100e41f4b71Sopenharmony_ci**Key API/Component Changes**
101e41f4b71Sopenharmony_ci
102e41f4b71Sopenharmony_ci|  Class | API | Change Description |
103e41f4b71Sopenharmony_ci| ------------ | ------------  | ------------ |
104e41f4b71Sopenharmony_ci| util.Base64Helper | encodeToStringSync(src: Uint8Array, options?: Type): string;  | The error code indicating parameter exceptions is changed from undefined to 401. |
105e41f4b71Sopenharmony_ci| util.Base64Helper | encode(src: Uint8Array, options?: Type): Promise\<Uint8Array>; | The error code indicating parameter exceptions is changed from undefined to 401. |
106e41f4b71Sopenharmony_ci| util.Base64Helper | encodeSync(src: Uint8Array, options?: Type): Uint8Array;  | The error code indicating parameter exceptions is changed from undefined to 401. |
107e41f4b71Sopenharmony_ci| util.Base64Helper | encodeToString(src: Uint8Array, options?: Type): Promise\<string>; | The error code indicating parameter exceptions is changed from undefined to 401. |
108e41f4b71Sopenharmony_ci| util.Base64Helper | decode(src: Uint8Array \| string, options?: Type): Promise\<Uint8Array>; | The error code indicating parameter exceptions is changed from undefined to 401. |
109e41f4b71Sopenharmony_ci| util.StringDecoder | constructor(encoding?: string);  | The error code indicating parameter exceptions is changed from undefined to 401. |
110e41f4b71Sopenharmony_ci| util.StringDecoder | write(chunk: string \| Uint8Array): string;  | The error code indicating parameter exceptions is changed from undefined to 401. |
111e41f4b71Sopenharmony_ci| util.StringDecoder | end(chunk?: string \| Uint8Array): string;  | The error code indicating parameter exceptions is changed from undefined to 401. |
112e41f4b71Sopenharmony_ci
113e41f4b71Sopenharmony_ci**Adaptation Guide**
114e41f4b71Sopenharmony_ci
115e41f4b71Sopenharmony_ciChange the error code indicating parameter exceptions from undefined to 401 in your code.
116