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