In C#, Char.ConvertFromUtf32 takes a Unicode scalar value (UTF-32 code point) and returns a string containing the UTF-16 encoding—one char for BMP, or a surrogate pair for higher planes.
Use it when you have a numeric code point and need text.
This is a static member of System.Char. You call it with the type name, such as Char.ConvertFromUtf32(...) or char.ConvertFromUtf32(...). A char holds one 16-bit UTF-16 code unit.
Syntax
Pass an int code point; receive a string.
C#
string s = Char.ConvertFromUtf32(0x1F600);
Call
What it does
Char.ConvertFromUtf32(0x41)
Returns "A" (one char).
Char.ConvertFromUtf32(0x1F600)
Returns a two-char emoji string.
Throws if the value is not a valid scalar (for example a lone surrogate code).
Library declarations
C#
public static string ConvertFromUtf32(int utf32);
Parameters
Parameter
Description
utf32
Unicode code point (scalar value).
Return Value
Return Value
Description
string
One or two UTF-16 code units as a string.
C# Examples
Example 1 — Code Point to A
Convert 0x41 to the letter A.
C#
using System;
class Program {
static void Main() {
string s = Char.ConvertFromUtf32(0x41);
Console.WriteLine(s);
Console.WriteLine(s.Length);
}
}
Output
A
1
How It Works
BMP value. 0x41 is Latin A.
Length 1. Fits in one char.
String result. Even one unit returns a string.
Round trip ready. Can convert back with ConvertToUtf32.
Example 2 — Smile From Code Point
Build 😀 from U+1F600.
C#
using System;
class Program {
static void Main() {
string s = Char.ConvertFromUtf32(0x1F600);
Console.WriteLine(s.Length);
Console.WriteLine(Char.IsSurrogatePair(s, 0));
}
}
Output
2
True
How It Works
Supplementary plane. Needs a surrogate pair.
Length 2. Two UTF-16 units.
Pair valid. IsSurrogatePair confirms structure.
From number. Useful when codes come from data.
Example 3 — Mix BMP and Emoji
Concatenate a letter and an emoji from code points.
C#
using System;
class Program {
static void Main() {
string text = Char.ConvertFromUtf32(0x41) + Char.ConvertFromUtf32(0x1F600);
Console.WriteLine("units: " + text.Length);
Console.WriteLine("starts with A: " + (text[0] == 'A'));
}
}
Output
units: 3
starts with A: True
How It Works
Concatenate. BMP + supplementary.
Three units. A plus two surrogate chars.
First is A. Index 0 is the letter.
Length ≠ glyphs. Unit count is not always visible count.