{"id":1972,"date":"2026-01-06T20:02:39","date_gmt":"2026-01-06T20:02:39","guid":{"rendered":"https:\/\/clarionsharp.com\/blog\/?p=1972"},"modified":"2026-01-06T20:02:42","modified_gmt":"2026-01-06T20:02:42","slug":"understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation","status":"publish","type":"post","link":"https:\/\/clarionsharp.com\/blog\/understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation\/","title":{"rendered":"Understanding USTRING: A Deep Dive into Clarion 12&#8217;s UTF-16 Implementation"},"content":{"rendered":"\n<p class=\"intro\">This post focuses on practical details and what they mean for your day-to-day development, with an eye toward where we&#8217;re headed next.<\/p>\n\n\n\n<p>In our <a href=\"https:\/\/clarionsharp.com\/blog\/clarion-12-beta-ustring-returns-ansi-unicode\/\">previous article<\/a>, we announced the USTRING data type was coming back, and its intended role in Clarion 12&#8217;s Unicode support. Now, let&#8217;s explore the implementation details that will help you work more effectively with the USTRING.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">USTRING is UTF-16: What This Means for You<\/h2>\n\n\n\n<p>At its core, the USTRING data type uses UTF-16 encoding, allocating two bytes per character. This architectural decision provides several key advantages:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Native Windows support<\/strong>: Windows internally uses UTF-16 for all Unicode operations, making USTRING integration seamless<\/li>\n\n\n\n<li><strong>Fixed-width benefits<\/strong>: Most common characters (including all Latin, Cyrillic, Greek, and CJK characters in the Basic Multilingual Plane) use exactly 2 bytes, simplifying string indexing<\/li>\n\n\n\n<li><strong>Complete Unicode coverage<\/strong>: Through surrogate pairs, UTF-16 can represent every Unicode character<\/li>\n\n\n\n<li><strong>Predictable memory usage<\/strong>: Easy calculation of memory requirements<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>Name     USTRING(21)              ! 21-character Unicode string\nCompany  USTRING('SoftVelocity')  ! Initialized with a value\nPhone    USTRING(@P(###)###-####P) ! Formatted with picture token\nMyStr    USTRING(20)              ! 20 characters available\n<\/code><\/pre>\n\n\n\n<p>When you declare <code>USTRING(20)<\/code>, you&#8217;re reserving space for 20 characters plus a null terminator. Internally, this allocates 42 bytes (21 characters \u00d7 2 bytes each).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Memory Layout: USTRING(20)\n\nDeclaration:  USTRING(20)\nAllocation:   &#91;    40 bytes for 20 characters    ]&#91;2 bytes null]\n              |&lt;\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 20 chars \u00d7 2 bytes \u2500\u2500\u2500\u2500\u2500&gt;|\nTotal Size:   42 bytes\n\nExample with \"Hello\":\nPosition:     1    2    3    4    5    6-20  21\nCharacter:    H    e    l    l    o    (empty) \\0\nBytes:       &#91;H ]&#91;e ]&#91;l ]&#91;l ]&#91;o ]&#91;  ...  ]&#91;\\0]\n              2   2   2   2   2      30      2\n                                          WCHAR(0)\n              &lt;\u2500\u2500\u2500 40 bytes for data \u2500\u2500\u2500\u2500&gt; &lt;2&gt;\n\nTotal: 42 bytes allocated (40 for characters + 2 for null terminator)\n<\/code><\/pre>\n\n\n\n<p><strong>Important:<\/strong> The null terminator WCHAR(0) occupies 2 bytes because it&#8217;s a wide character, just like every other character in the string. This is how functions like <code>lstrlenW<\/code> know where the string ends\u2014they scan for this 2-byte null value.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Dual Character Set Support: The Best of Both Worlds<\/h2>\n\n\n\n<p>One of USTRING&#8217;s practical strengths is transparent handling of both Unicode and ANSI content. You can freely mix Unicode literals and ANSI strings in your code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>MYUSTR  USTRING(50)\n\nCODE\n  MYUSTR = u'\u0391 \u03a9'            ! Greek Unicode characters\n  MYUSTR = 'Regular Text'    ! ANSI text works too\n  MYUSTR = u'Mix: ' &amp; '\u0391 \u03a9' ! Concatenate both types\n<\/code><\/pre>\n\n\n\n<p>The runtime handles conversions automatically, respecting the current code page settings. When working with international applications, you can set the code page and locale to ensure proper character handling:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SYSTEM {PROP:Codepage} = 1253   ! Greece\nSYSTEM {PROP:Locale} = 1032     ! Greece\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">LEN() vs SIZE(): A Critical Distinction<\/h2>\n\n\n\n<p>This is where developers first encounter USTRING&#8217;s two-byte nature. The distinction between <code>LEN()<\/code> and <code>SIZE()<\/code> directly reflects the UTF-16 implementation:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>MYUSTR  USTRING(20)\nL       LONG\nS       LONG\n\nCODE\n  MYUSTR = u'\u0391 \u03a9'            ! 3 Unicode characters\n  L = LEN(MYUSTR)            ! L = 3 (character count)\n  S = SIZE(MYUSTR)           ! S = 40 (20 characters \u00d7 2 bytes)\n<\/code><\/pre>\n\n\n\n<p><strong>LEN()<\/strong> returns the logical length\u2014the number of characters actually stored in the string. This is what you typically care about when processing text.<\/p>\n\n\n\n<p><strong>SIZE()<\/strong> returns the allocated byte capacity. For a <code>USTRING(20)<\/code>, SIZE() always returns 40, regardless of how many characters you&#8217;ve stored. This represents the maximum storage available.<\/p>\n\n\n\n<p>Understanding this distinction matters when:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Allocating buffers for string operations<\/li>\n\n\n\n<li>Interfacing with external APIs that expect byte counts<\/li>\n\n\n\n<li>Optimizing memory usage in data structures<\/li>\n\n\n\n<li>Working with file I\/O operations<\/li>\n<\/ul>\n\n\n\n<div style=\"background: #fff3cd; border-left: 4px solid #ffc107; padding: 15px; margin: 1.5em 0; border-radius: 4px;\">\n<h3>How SIZE() Actually Works<\/h3>\n<p>For fixed-size declarations like <code>USTRING(20)<\/code>, SIZE() is calculated by the <strong>Clarion compiler at compile-time<\/strong>. The compiler knows the capacity is 20 characters and generates code that returns <code>20 \u00d7 2 = 40<\/code> directly\u2014no runtime function call needed.<\/p>\n<p>This is why SIZE() is so fast: it&#8217;s just a constant value, not a calculation that happens when your code runs.<\/p>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\">When LEN() and SIZE() Differ: A Practical Example<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>UserInput  USTRING(100)      ! Allocated capacity: 100 chars\nBytes      LONG\nChars      LONG\n\nCODE\n  UserInput = ''             ! Empty string\n  Chars = LEN(UserInput)     ! Chars = 0 (no content)\n  Bytes = SIZE(UserInput)    ! Bytes = 200 (capacity still allocated)\n\n  UserInput = u'Hi'          ! Short string\n  Chars = LEN(UserInput)     ! Chars = 2 (actual content)\n  Bytes = SIZE(UserInput)    ! Bytes = 200 (capacity unchanged)\n\n  ! Key insight: SIZE() never changes after declaration\n  ! LEN() reflects actual content\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Memory Allocation: Understanding the 2:1 Ratio<\/h2>\n\n\n\n<p>When you declare a USTRING, the actual memory allocated is double the character count you specify:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Small   USTRING(10)              ! Allocates 20 bytes (10 \u00d7 2)\nMedium  USTRING(100)             ! Allocates 200 bytes (100 \u00d7 2)\nLarge   USTRING(1000)            ! Allocates 2000 bytes (1000 \u00d7 2)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Right-Sizing Your Strings<\/h3>\n\n\n\n<p>Choose appropriate sizes to avoid wasting memory. Here&#8217;s what oversizing costs:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>! Good - sized appropriately\nFirstName  USTRING(50)            ! 100 bytes allocated\n\n! Wasteful - unnecessarily large\nUserName   USTRING(500)           ! 1000 bytes allocated\n                                  ! If only ~50 chars used: 100 used, 900 wasted\n\nComment    USTRING(5000)          ! 10,000 bytes allocated\n                                  ! If only ~100 chars used: 200 used, 9,800 wasted\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">When Memory Size Actually Matters<\/h3>\n\n\n\n<p>Understanding when to worry about USTRING memory overhead:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>! Scenario 1: Single string - overhead is negligible\nCustomerName  USTRING(100)     ! 200 bytes total\n! Impact: Minimal - 100 extra bytes compared to ANSI\n\n! Scenario 2: Large collections - overhead multiplies\nCustomerQueue QUEUE\nName            USTRING(100)   ! 200 bytes\nAddress         USTRING(200)   ! 400 bytes\nCity            USTRING(50)    ! 100 bytes\n              END\n\n! Impact with 100,000 records in queue:\n! USTRING: 70,000,000 bytes (70 MB)\n! STRING:  35,000,000 bytes (35 MB)\n! Difference: 35 MB - this is where sizing matters!\n\n! Or with an array:\nCustomerArray USTRING(100), DIM(100000)  ! 20,000,000 bytes (20 MB)\n! vs STRING(100), DIM(100000)            ! 10,000,000 bytes (10 MB)\n<\/code><\/pre>\n\n\n\n<p><strong>Rule of thumb:<\/strong> For individual strings, use generous sizes. For large queues, arrays, or tables, size more carefully.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Design-Time vs Runtime Allocation<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>! Design-time: Fixed size declared in source\nMyStr  USTRING(100)          ! 200 bytes allocated at compile time\n\n! Runtime: Dynamic allocation with NEW\nMyStr &amp;USTRING               ! Reference to dynamically allocated string\nCODE\n  MyStr &amp;= NEW USTRING(100)  ! 200 bytes allocated at runtime\n<\/code><\/pre>\n\n\n\n<p>Design-time declarations have a maximum size of 4MB, while runtime allocations can be sized dynamically based on your application&#8217;s needs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Working with Unicode Literals<\/h2>\n\n\n\n<p>When initializing or assigning to a USTRING, use the <code>U<\/code> or <code>u<\/code> prefix for Unicode literals:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>MyStr USTRING(50)\nCODE\n  MyStr = U'\u03a9 \u03b1 \u03b2'     ! Correct - U prefix for Unicode\n  MyStr = u'\u03a9 \u03b1 \u03b2'     ! Also correct - lowercase works too\n  MyStr = '\u03a9 \u03b1 \u03b2'      ! Works but may not preserve Unicode properly\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Practical Implications for Your Code<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Character Access is Read-Only on Assignment<\/h3>\n\n\n\n<p>You can read individual characters using slice syntax, but cannot assign to them:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>C = MyStr&#91;5]        ! Read character at position 5 - ALLOWED\nMyStr&#91;1] = 'A'      ! ERROR - Not allowed, creates invalid string\n<\/code><\/pre>\n\n\n\n<p>This restriction maintains string integrity in the UTF-16 implementation.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Use LEN() for Logic, SIZE() for Memory<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>! Correct usage\nIF LEN(UserInput) &gt; 0            ! Check if string has content\n  ! Process input\nEND\n\n! Memory allocation calculation\nBytesNeeded = SIZE(MyStr)        ! Get total allocated bytes\n<\/code><\/pre>\n\n\n\n<div class=\"callout\">\n<h3>Current Limitations<\/h3>\n<p>The current implementation doesn&#8217;t support Unicode strings in these specific contexts:<\/p>\n<ul>\n<li><code>EVALUATE<\/code> statement<\/li>\n<li><code>MATCH<\/code> built-in function<\/li>\n<li><code>STRPOS<\/code> built-in function<\/li>\n<\/ul>\n<p>These are implementation-specific constraints that may be addressed in future releases.<\/p>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Working Example: Practical USTRING Usage<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>MAP\n  MODULE('API')\n    GetSystemInfo(*LONG, *LONG), PROC, RAW, PASCAL, NAME('GetSystemInfo')\n  END\nEND\n\nMyName    USTRING(50)\nMyCompany USTRING(100)\nFullInfo  USTRING(200)\nCharCount LONG\nByteCount LONG\n\nCODE\n  ! Assign Unicode content\n  MyName = u'\u0391\u03bb\u03ad\u03be\u03b1\u03bd\u03b4\u03c1\u03bf\u03c2'       ! Greek name\n  MyCompany = u'SoftVelocity'   ! Company name\n  \n  ! Concatenate strings\n  FullInfo = MyName &amp; u' - ' &amp; MyCompany\n  \n  ! Get character count and byte size\n  CharCount = LEN(FullInfo)     ! Actual characters in string\n  ByteCount = SIZE(FullInfo)    ! Total bytes allocated\n  \n  ! Display results\n  MESSAGE('Name: ' &amp; MyName &amp; |\n          '|Characters: ' &amp; CharCount &amp; |\n          '|Bytes Allocated: ' &amp; ByteCount)\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Behind the Scenes: What Happens When You Concatenate<\/h2>\n\n\n\n<p>When you write a string expression like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Result = FirstName &amp; ' ' &amp; LastName\n<\/code><\/pre>\n\n\n\n<p>The Clarion runtime evaluates it using a string stack\u2014a temporary workspace for building the final result. Here&#8217;s the step-by-step process:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>String Expression Evaluation\n\nStep 1: Push FirstName onto stack       \u2192 Stack: &#91;FirstName]\nStep 2: Push ' ' onto stack             \u2192 Stack: &#91;FirstName]&#91;' ']\nStep 3: Concatenate top 2 items         \u2192 Stack: &#91;FirstName ]\nStep 4: Push LastName onto stack        \u2192 Stack: &#91;FirstName ]&#91;LastName]\nStep 5: Concatenate top 2 items         \u2192 Stack: &#91;FirstName LastName]\nStep 6: Pop result into Result variable \u2192 Result gets final string\n<\/code><\/pre>\n\n\n\n<p>This stack-based approach doesn&#8217;t create temporary variables that need cleanup. The runtime handles all intermediate strings automatically, and they vanish when the expression completes.<\/p>\n\n\n\n<p><strong>Why this matters for you:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Write complex expressions freely<\/strong> &#8211; No performance penalty for chaining operations<\/li>\n\n\n\n<li><strong>No memory leaks<\/strong> &#8211; Intermediate results are cleaned up automatically<\/li>\n\n\n\n<li><strong>Thread-safe by design<\/strong> &#8211; Each thread has its own string stack, no locking needed<\/li>\n\n\n\n<li><strong>Efficient memory use<\/strong> &#8211; Stack allocation is faster than heap allocation for temporaries<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<div style=\"background: #fff3cd; border-left: 4px solid #ffc107; padding: 15px; margin: 1.5em 0; border-radius: 4px;\">\n<h3>Performance Implication<\/h3>\n<p>The string stack is why expressions like <code>Name = FirstName &amp; ' ' &amp; MiddleName &amp; ' ' &amp; LastName<\/code> don&#8217;t create memory leaks or slow down your application. Each intermediate result (<code>FirstName &amp; ' '<\/code>, etc.) exists only temporarily on the stack and is automatically cleaned up.<\/p>\n<p><strong>Best practice:<\/strong> Write natural, readable string expressions. The runtime is optimized for this pattern.<\/p>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Common Pitfalls and How to Avoid Them<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Pitfall 1: Using SIZE() When You Mean LEN()<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>! WRONG - This won't work as expected\nName  USTRING(50)\nCODE\n  Name = u'John'\n  IF SIZE(Name) &gt; 10         ! Always TRUE (SIZE is 100, not 8)\n    ! This always executes\n  END\n\n! CORRECT - Use LEN() for content checks\n  IF LEN(Name) &gt; 10          ! FALSE (LEN is 4)\n    ! This executes only when needed\n  END\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Pitfall 2: Buffer Size Confusion<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>! WRONG - Allocating based on character count for bytes\nName     USTRING(50)\nBuffer   STRING(LEN(Name))    ! Too small! Only 50 bytes, need 100\n\n! CORRECT - Use SIZE() for byte allocations\nBuffer   STRING(SIZE(Name))   ! Correct: 100 bytes\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Pitfall 3: Forgetting the U Prefix<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>Greek  USTRING(20)\nCODE\n  ! INEFFICIENT - ANSI string converted to Unicode at runtime\n  Greek = '\u0391\u03b8\u03ae\u03bd\u03b1'\n\n  ! EFFICIENT - Direct Unicode assignment, no conversion\n  Greek = u'\u0391\u03b8\u03ae\u03bd\u03b1'\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Migration from STRING to USTRING: Real Examples<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Example 1: Buffer Sizing<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>! Before (ANSI STRING)\nName    STRING(50)           ! 50 bytes\nBuffer  STRING(SIZE(Name))   ! 50 bytes\n\n! After (USTRING)\nName    USTRING(50)          ! 100 bytes (50 \u00d7 2)\nBuffer  STRING(SIZE(Name))   ! 100 bytes - SIZE() handles it correctly\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Example 2: Loop Iterations<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>! Before (ANSI STRING)\nText  STRING(100)\nI     LONG\nCODE\n  LOOP I = 1 TO LEN(Text)    ! Good - use LEN() not SIZE()\n    ! Process Text&#91;I]\n  END\n\n! After (USTRING)\nText  USTRING(100)\nI     LONG\nCODE\n  LOOP I = 1 TO LEN(Text)    ! Same - LEN() still correct\n    ! Process Text&#91;I]\n  END\n  ! KEY: LEN() works the same way for both types!\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Example 3: API Calls<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>! Before (ANSI STRING)\nBuffer  STRING(1000)\nSize    LONG\nCODE\n  Size = SIZE(Buffer)        ! 1000 bytes\n  ! Pass Size to Windows API expecting byte count\n\n! After (USTRING)\nBuffer  USTRING(1000)\nSize    LONG\nCODE\n  Size = SIZE(Buffer)        ! 2000 bytes (1000 \u00d7 2)\n  ! SIZE() correctly returns byte count for Unicode APIs\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Migration Considerations<\/h2>\n\n\n\n<p>When moving existing ANSI string code to USTRING:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use <code>LEN()<\/code> for character-based logic, not <code>SIZE()<\/code><\/li>\n\n\n\n<li>Add <code>U<\/code> prefix to string literals containing Unicode characters<\/li>\n\n\n\n<li>Test with international character sets if your application supports them<\/li>\n\n\n\n<li>Be aware of the <code>EVALUATE<\/code>, <code>MATCH<\/code>, and <code>STRPOS<\/code> limitations<\/li>\n\n\n\n<li>Review buffer size calculations\u2014you may need double the byte count you used with ANSI<\/li>\n<\/ul>\n\n\n\n<div class=\"key-takeaways\">\n<h2>Looking Forward<\/h2>\n<p>The USTRING implementation provides a solid foundation for Unicode support while maintaining the Clarion language&#8217;s characteristic simplicity. The UTF-16 encoding, dual character set support, and clear LEN\/SIZE distinction give you the tools needed for modern, international applications.<\/p>\n<p><strong>Key takeaways:<\/strong><\/p>\n<ul>\n<li>USTRING uses UTF-16 encoding (2 bytes per character)<\/li>\n<li>Automatic conversion between ANSI and Unicode character sets<\/li>\n<li>LEN() returns character count; SIZE() returns byte count<\/li>\n<li>USTRING(n) allocates n \u00d7 2 bytes of memory<\/li>\n<li>Code page awareness ensures proper locale handling<\/li>\n<li>Runtime uses string stack for efficient expression evaluation<\/li>\n<\/ul>\n<\/div>\n\n\n\n<p><em>Thanks for being part of the Clarion community. If you try this out, let us know what you think \u2014 and stay tuned, there&#8217;s more to come.<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>Related:<\/strong> <a href=\"https:\/\/clarionsharp.com\/blog\/clarion-12-beta-ustring-returns-ansi-unicode\/\">Clarion 12 Beta: USTRING Returns ANSI &amp; Unicode<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post focuses on practical details and what they mean for your day-to-day development, with an eye toward where we&#8217;re headed next. In our previous article, we announced the USTRING data type was coming back, and its intended role in Clarion 12&#8217;s Unicode support. Now, let&#8217;s explore the implementation details that will help you work &hellip; <a href=\"https:\/\/clarionsharp.com\/blog\/understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Understanding USTRING: A Deep Dive into Clarion 12&#8217;s UTF-16 Implementation<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43,5],"tags":[48,45,51,50,47,49],"class_list":["post-1972","post","type-post","status-publish","format-standard","hentry","category-clarion-12","category-clarionnews","tag-ansi","tag-clarion-12","tag-deep-dive","tag-implementation","tag-unicode","tag-ustring"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Understanding USTRING: A Deep Dive into Clarion 12&#039;s UTF-16 Implementation - Clarion<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/clarionsharp.com\/blog\/understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Understanding USTRING: A Deep Dive into Clarion 12&#039;s UTF-16 Implementation - Clarion\" \/>\n<meta property=\"og:description\" content=\"This post focuses on practical details and what they mean for your day-to-day development, with an eye toward where we&#8217;re headed next. In our previous article, we announced the USTRING data type was coming back, and its intended role in Clarion 12&#8217;s Unicode support. Now, let&#8217;s explore the implementation details that will help you work &hellip; Continue reading Understanding USTRING: A Deep Dive into Clarion 12&#8217;s UTF-16 Implementation &rarr;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/clarionsharp.com\/blog\/understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation\/\" \/>\n<meta property=\"og:site_name\" content=\"Clarion\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/softvelocity\/\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-06T20:02:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-01-06T20:02:42+00:00\" \/>\n<meta name=\"author\" content=\"rzaunere\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"rzaunere\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation\\\/\"},\"author\":{\"name\":\"rzaunere\",\"@id\":\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/#\\\/schema\\\/person\\\/b90e860529aea05ad064cf2687697ce3\"},\"headline\":\"Understanding USTRING: A Deep Dive into Clarion 12&#8217;s UTF-16 Implementation\",\"datePublished\":\"2026-01-06T20:02:39+00:00\",\"dateModified\":\"2026-01-06T20:02:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation\\\/\"},\"wordCount\":1002,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/#organization\"},\"keywords\":[\"ANSI\",\"Clarion 12\",\"Deep Dive\",\"Implementation\",\"Unicode\",\"USTRING\"],\"articleSection\":[\"Clarion 12\",\"Clarion News\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation\\\/\",\"url\":\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation\\\/\",\"name\":\"Understanding USTRING: A Deep Dive into Clarion 12's UTF-16 Implementation - Clarion\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/#website\"},\"datePublished\":\"2026-01-06T20:02:39+00:00\",\"dateModified\":\"2026-01-06T20:02:42+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Understanding USTRING: A Deep Dive into Clarion 12&#8217;s UTF-16 Implementation\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/\",\"name\":\"Clarion\",\"description\":\"Deliver your software on time, every time\",\"publisher\":{\"@id\":\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/#organization\",\"name\":\"SoftVelocity\",\"url\":\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/svlogonew57.png\",\"contentUrl\":\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/svlogonew57.png\",\"width\":221,\"height\":57,\"caption\":\"SoftVelocity\"},\"image\":{\"@id\":\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/softvelocity\\\/\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/SoftVelocity\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/#\\\/schema\\\/person\\\/b90e860529aea05ad064cf2687697ce3\",\"name\":\"rzaunere\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/91d95e38759c411d27f646b60da7f4769ce91e87b484669af240e51c729b1e7c?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/91d95e38759c411d27f646b60da7f4769ce91e87b484669af240e51c729b1e7c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/91d95e38759c411d27f646b60da7f4769ce91e87b484669af240e51c729b1e7c?s=96&d=mm&r=g\",\"caption\":\"rzaunere\"},\"url\":\"https:\\\/\\\/clarionsharp.com\\\/blog\\\/author\\\/rzaunere\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Understanding USTRING: A Deep Dive into Clarion 12's UTF-16 Implementation - Clarion","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/clarionsharp.com\/blog\/understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation\/","og_locale":"en_US","og_type":"article","og_title":"Understanding USTRING: A Deep Dive into Clarion 12's UTF-16 Implementation - Clarion","og_description":"This post focuses on practical details and what they mean for your day-to-day development, with an eye toward where we&#8217;re headed next. In our previous article, we announced the USTRING data type was coming back, and its intended role in Clarion 12&#8217;s Unicode support. Now, let&#8217;s explore the implementation details that will help you work &hellip; Continue reading Understanding USTRING: A Deep Dive into Clarion 12&#8217;s UTF-16 Implementation &rarr;","og_url":"https:\/\/clarionsharp.com\/blog\/understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation\/","og_site_name":"Clarion","article_publisher":"https:\/\/www.facebook.com\/softvelocity\/","article_published_time":"2026-01-06T20:02:39+00:00","article_modified_time":"2026-01-06T20:02:42+00:00","author":"rzaunere","twitter_card":"summary_large_image","twitter_misc":{"Written by":"rzaunere","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/clarionsharp.com\/blog\/understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation\/#article","isPartOf":{"@id":"https:\/\/clarionsharp.com\/blog\/understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation\/"},"author":{"name":"rzaunere","@id":"https:\/\/clarionsharp.com\/blog\/#\/schema\/person\/b90e860529aea05ad064cf2687697ce3"},"headline":"Understanding USTRING: A Deep Dive into Clarion 12&#8217;s UTF-16 Implementation","datePublished":"2026-01-06T20:02:39+00:00","dateModified":"2026-01-06T20:02:42+00:00","mainEntityOfPage":{"@id":"https:\/\/clarionsharp.com\/blog\/understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation\/"},"wordCount":1002,"commentCount":0,"publisher":{"@id":"https:\/\/clarionsharp.com\/blog\/#organization"},"keywords":["ANSI","Clarion 12","Deep Dive","Implementation","Unicode","USTRING"],"articleSection":["Clarion 12","Clarion News"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/clarionsharp.com\/blog\/understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/clarionsharp.com\/blog\/understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation\/","url":"https:\/\/clarionsharp.com\/blog\/understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation\/","name":"Understanding USTRING: A Deep Dive into Clarion 12's UTF-16 Implementation - Clarion","isPartOf":{"@id":"https:\/\/clarionsharp.com\/blog\/#website"},"datePublished":"2026-01-06T20:02:39+00:00","dateModified":"2026-01-06T20:02:42+00:00","breadcrumb":{"@id":"https:\/\/clarionsharp.com\/blog\/understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/clarionsharp.com\/blog\/understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/clarionsharp.com\/blog\/understanding-ustring-a-deep-dive-into-clarion-12s-utf-16-implementation\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/clarionsharp.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Understanding USTRING: A Deep Dive into Clarion 12&#8217;s UTF-16 Implementation"}]},{"@type":"WebSite","@id":"https:\/\/clarionsharp.com\/blog\/#website","url":"https:\/\/clarionsharp.com\/blog\/","name":"Clarion","description":"Deliver your software on time, every time","publisher":{"@id":"https:\/\/clarionsharp.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/clarionsharp.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/clarionsharp.com\/blog\/#organization","name":"SoftVelocity","url":"https:\/\/clarionsharp.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/clarionsharp.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/clarionsharp.com\/blog\/wp-content\/uploads\/2019\/03\/svlogonew57.png","contentUrl":"https:\/\/clarionsharp.com\/blog\/wp-content\/uploads\/2019\/03\/svlogonew57.png","width":221,"height":57,"caption":"SoftVelocity"},"image":{"@id":"https:\/\/clarionsharp.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/softvelocity\/","https:\/\/www.youtube.com\/user\/SoftVelocity"]},{"@type":"Person","@id":"https:\/\/clarionsharp.com\/blog\/#\/schema\/person\/b90e860529aea05ad064cf2687697ce3","name":"rzaunere","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/91d95e38759c411d27f646b60da7f4769ce91e87b484669af240e51c729b1e7c?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/91d95e38759c411d27f646b60da7f4769ce91e87b484669af240e51c729b1e7c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/91d95e38759c411d27f646b60da7f4769ce91e87b484669af240e51c729b1e7c?s=96&d=mm&r=g","caption":"rzaunere"},"url":"https:\/\/clarionsharp.com\/blog\/author\/rzaunere\/"}]}},"_links":{"self":[{"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/posts\/1972","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/comments?post=1972"}],"version-history":[{"count":3,"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/posts\/1972\/revisions"}],"predecessor-version":[{"id":1975,"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/posts\/1972\/revisions\/1975"}],"wp:attachment":[{"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/media?parent=1972"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/categories?post=1972"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/tags?post=1972"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}