UNICODE in Calligra Sheets: Identify the Unicode Code Point of the First Character
Return a Unicode scalar for the first character, including supplementary-plane characters, and compare with CODE.
Verification status: Official documentation referenced; example outcomes independently reasoned or arithmetically checked where stated. Not executed in Calligra Sheets. How formula examples are checked
Version scope: Official Calligra 26.08.2 source (KDE Gear release 2026-10-08); KDE stable KF6 English documentation, accessed 2026-10-11. The source registers UNICODE separately; no explicit registered alias for this canonical function in the pinned text module. The function has one required argument and no documented optional defaults. Native execution was not performed.
Quick answer: =UNICODE("KDE") is expected to return 75, the Unicode code point for K. Unlike CODE, Calligra 26.08.2’s implementation converts the string to UCS-4 (toUcs4().at(0)), so a supplementary character such as 😀 is expected to produce 128512 rather than its first UTF-16 surrogate. KDE handbook; version-pinned code.
Why UNICODE matters
Use UNICODE to inspect the first character of imported data, distinguish a regular space from a nonbreaking space, or recover a Unicode scalar number for a displayed letter or symbol. It is useful in multilingual worksheets because it is defined in terms of Unicode rather than a system code page. It examines only the first character; use additional string operations if you need to scan the rest.
Exact syntax, argument requirements and defaults
=UNICODE(text)
| Argument | Required? | Official type | Meaning | Default |
|---|---|---|---|---|
text |
Yes | Text | String or reference whose first character is inspected | None |
The pinned XML documentation specifies one string argument, integer return and UNICODE("KDE") → 75. The registration registers UNICODE separately from CODE. This one-parameter call has no separator; for IF and other multiple-argument calls the English handbook shows semicolons. Decimal formatting and function names may vary by locale; Unicode scalar values do not depend on a display font.
Reproduce this worksheet example
In A2:A7 type KDE, ©, €, 😀, a text with an ordinary leading space ( North) and éclair. Enter =UNICODE(A2) in B2, then fill through B7. These are source-derived and independently calculated expected values, not Calligra measurements.
| Formula | Expected result | Why |
|---|---|---|
=UNICODE("KDE") |
75 | KDE official example, K = U+004B |
=UNICODE("©") |
169 | U+00A9 |
=UNICODE("€100") |
8364 | U+20AC; only the first character is read |
=UNICODE("😀") |
128512 | U+1F600, source converts UTF-16 surrogate pair to UCS-4 first |
=UNICODE(" North") |
32 | Ordinary leading space U+0020 |
=UNICODE("éclair") |
233 | First precomposed character U+00E9 |
=UNICODE("") |
internal value error (errorVALUE) |
Explicit empty-string check in C++ |
Text-normalization caution: é can be encoded as a single precomposed code point U+00E9 or as e plus a combining accent; visual appearance alone does not make the first UNICODE result equal. For a decomposed leading e, the first scalar is U+0065 = 101. This is a property of the input sequence, not an indication that UNICODE is unreliable.
Advanced checks: spaces and non-ASCII input
Type into A2 an identifier copied from a web page. In B2 enter:
=IF(UNICODE(A2)=32;"Starts with ordinary space";"First character is not U+0020")
For West the expected result is Starts with ordinary space. A nonbreaking space is U+00A0 = 160, so this check intentionally will not treat it as an ordinary space. To avoid a value error when there is no first character, use:
=IF(LEN(A2)=0;"Empty";UNICODE(A2))
For BMP symbols, =UNICODE(UNICHAR(8364)) is source-derived as 8364. Do not generalize this round trip to an emoji: Calligra’s UNICHAR implementation uses a single 16-bit unit and cannot synthesize an arbitrary supplementary character, even though UNICODE can read one from a string.
Error behaviour, Unicode and troubleshooting
The C++ code converts the value to a string, returns internal errorVALUE if the string is empty, then returns the first item of a toUcs4() conversion. This is source inspection, not a direct application test of #VALUE! rendering. If an emoji seems to give a much smaller integer in another function, check whether you used CODE (first UTF-16 unit) instead of UNICODE (first full code point). If a strange value appears for multilingual names, inspect normalization, leading spaces and whether pasted characters are valid.
The 26.08.2 source does not establish every possible malformed-surrogate handling path, nor does it establish installed edition support. Do not describe an unobserved error code or behavior as tested. For numeric-looking inputs, type a literal text example before inferring locale-dependent conversion from a reference cell.
Excel and LibreOffice comparison
Microsoft’s Excel UNICODE documentation likewise describes the numeric code point of the first character; LibreOffice Calc’s UNICODE reference describes the same concept. This supports a conceptual match, not proof that malformed Unicode, text coercion, errors, or separators behave identically. Microsoft’s CHAR and CODE documentation use platform-specific character-set conventions, while Calligra’s pinned UNICODE uses Qt UCS-4 conversion. Always compare representative cells when exchanging documents.
Related official references
Source scope, date and validation disclosure
- KDE stable-KF6 function handbook — documented syntax and example; checked 2026-10-11. The stable handbook is not a native runtime test.
- Calligra 26.08.2 function registration — official version-pinned source, checked 2026-10-11.
- Official Calligra XML help for text functions — shipped argument-type definitions, checked 2026-10-11.
- KDE 26.08.2 release announcement — release 2026-10-08; checked 2026-10-11.
Validation: Official documentation, immutable implementation and independent code-point calculations were checked. No native Calligra execution, installed-platform checks, glyph rendering or workbook interchange tests were performed.