title: UTF-8 encoding in c
body: <p>what is <code>UTF-8</code> encoding? I google it but could not able to understand what it is. Please explain in simple words and example.</p>
  
  <p>Next I need to encode one string in <code>UTF-8</code> encoding. I got <code>openssl</code> but it is converting in only <code>base64</code> format.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  
  struct some
  {
      char string[40];
  };
  
  int main() 
  {
      string *s;
      char str[9];
      gets(str);
      strcpy(s,str);
      /*Now how to get emcoded form of "Hello" in UTF-8*/
      /*printf("encoded data");
      return 0;
  }
  </code></pre>
  
  <p>Those strings are available at <code>runtime</code> so do not anything about what is coming. and after encoding need to store them in <code>DB</code>.</p>
  
  <p>I checked it on <code>SO</code> itself but could not find any source in <code>c</code>, it is available in <code>.net</code> <code>java</code> <code>c#</code>. I am using <code>linux Redhat</code>.</p>