title: Setting Unicode Caption from Resource DLL String Table
body: <p>I'm having trouble with Unicode characters being displayed incorrectly on my UI.  I have a resource-only DLL containing a string table used for UI localization.  I create the DLL in Delphi XE3 with a DLL-only project (just has <code>{$R 'lang.res' 'lang.rc'}</code> in the DPR file, and gives me <code>lang.dll</code>).  I've verified that my lang.rc file is in UTF-8 format with Windows CRLF line breaks.  When I load the strings from the DLL, Unicode characters are jumbled on the interface.  Here are some details.</p>
  
  <p>A snippet from the string table:</p>
  
  <pre><code>STRINGTABLE
  {
  59,"180˚"
  60,"90˚ CW"
  61,"90˚ CCW"
  }
  </code></pre>
  
  <p>Here are code snippets that illustrate the problem I'm having with Unicode characters:</p>
  
  <pre><code>// explicitly assigning the degrees character shows 180˚ properly
  ImageMenu180Action.Caption := '180˚'; 
  
  // getting the resource from the DLL shows some weird two-character string for the degrees character
  ImageMenu90CWAction.Caption := TLangHelper.LoadStr(IDS_ImageMenuRotationCW90);
  
  // OutputDebugString shows the degrees character in the debugger output correctly
  OutputDebugString(PChar('IDS_ImageMenuRotationCW90: '+TLangHelper.LoadStr(IDS_ImageMenuRotationCW90)));
  </code></pre>
  
  <p>Here is my Delphi function used for loading strings from the resource DLL: </p>
  
  <pre><code>class function TLangHelper.LoadStr(ResourceId: Integer):String;
  var
     Buff: String;
     L: Integer;
  begin
    Result := '';
    if LangDllHandle = 0 then begin
      LangDllHandle := LoadLibrary(LANGUAGE_DLL_LOCATION);
      if LangDllHandle = 0 then begin
        ShowMessage('Error loading language localization resources.');
      end;
    end;
    if LangDllHandle &lt;&gt; 0 then begin
      L := 1024;
      SetLength(Buff, L+1);
      LoadString(LangDllHandle, ResourceId, PChar(Buff), L);
      Result := String(PChar(Buff));
    end;
  end;
  </code></pre>
  
  <p>Any suggestions?</p>
  
  <p><strong>FOLLOW-UP:</strong></p>
  
  <p>For Chinese characters, I had to add a preceding L to the string definitions in the .rc file so that the DLL compilation recognized them as Unicode.  For example (English, Chinese Traditional, Chinese Simplified, French):</p>
  
  <pre><code>STRINGTABLE
  {
  35,"Status Bar"
  1035,L"狀態欄"
  2035,L"状态栏"
  3035,"Barre d'état"
  }
  </code></pre>