You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/Generation.php
+48-4Lines changed: 48 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -244,10 +244,54 @@ public function getCodeText(): string
244
244
245
245
/**
246
246
* <p>
247
-
* Encodes codetext with byte order mark (BOM) using specified encoding.
248
-
* </p>
249
-
* @param string|array codeText CodeText string | Bytes of codetext
250
-
* @param int encoding
247
+
* <p>
248
+
* Encodes the Unicode {@code <b>codeText</b>} into a byte sequence using the specified {@code <b>encoding</b>}.
249
+
* UTF-8 is the most commonly used encoding.
250
+
* If the encoding supports it and {@code <b>insertBOM</b>} is set to {@code true}, the function includes a
251
+
* {@code <a href="https://en.wikipedia.org/wiki/Byte_order_mark#Byte-order_marks_by_encoding">byte order mark (BOM)</a>}.
252
+
* </p>
253
+
* <p>
254
+
* This function is intended for use with 2D barcodes only (e.g., Aztec, QR, DataMatrix, PDF417, MaxiCode, DotCode, HanXin, RectMicroQR, etc.).
255
+
* It enables manual encoding of Unicode text using national or special encodings; however, this method is considered obsolete in modern applications.
256
+
* For modern use cases, {@code <a href="https://en.wikipedia.org/wiki/Extended_Channel_Interpretation">ECI</a>} encoding is recommended for Unicode data.
257
+
* </p>
258
+
* <p>
259
+
* Using this function with 1D barcodes, GS1-compliant barcodes (including 2D), or HIBC barcodes (including 2D) is not supported by the corresponding barcode standards and may lead to unpredictable results.
260
+
* </p>
261
+
* </p><p><hr><blockquote><pre>
262
+
* <p>This example shows how to use {@code SetCodeText} with or without a BOM for 2D barcodes.</p>
263
+
* <pre>
264
+
* //Encode codetext using UTF-8 with BOM
265
+
* $gen = new BarcodeGenerator(EncodeTypes::QR, null);
0 commit comments