<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <br>
    <div class="moz-cite-prefix">On Sunday 31 January 2016 07:27 AM,
      Andre LaBranche wrote:<br>
    </div>
    <blockquote
      cite="mid:36216323-2428-4EE9-A6AD-ED3D5F9AC247@apple.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <br class="">
      <div>
        <blockquote type="cite" class="">
          <div class="">On Jan 30, 2016, at 1:18 PM, Andre LaBranche
            &lt;<a moz-do-not-send="true" href="mailto:dre@apple.com"
              class="">dre@apple.com</a>&gt; wrote:</div>
          <br class="Apple-interchange-newline">
          <div class=""><span style="font-family: Helvetica; font-size:
              12px; font-style: normal; font-variant: normal;
              font-weight: normal; letter-spacing: normal; orphans:
              auto; text-align: start; text-indent: 0px; text-transform:
              none; white-space: normal; widows: auto; word-spacing:
              0px; -webkit-text-stroke-width: 0px; float: none; display:
              inline !important;" class="">This is not expected. Does
              memcached need to be configured for Unicode, maybe?</span></div>
        </blockquote>
      </div>
      <br class="">
      <div class="">It looks like we expect to be in ascii mode, as far
        as memcached is concerned:</div>
      <div class=""><br class="">
      </div>
      <div class="">You can debug the memcache side of this by
        configuring calendarserver to not launch memcached; instead
        you'll do so manually, in the foreground.</div>
      <div class=""><br class="">
      </div>
      <div class="">Edit caldavd.plist, and insert the following Pools
        configuration under the Memcached dict:</div>
      <div class=""><br class="">
      </div>
      <div class="">      &lt;key&gt;Pools&lt;/key&gt;<br class="">
              &lt;dict&gt;<br class="">
                  &lt;key&gt;Default&lt;/key&gt;<br class="">
                  &lt;dict&gt;<br class="">
                      &lt;key&gt;MemcacheSocket&lt;/key&gt;<br class="">
                      &lt;string&gt;&lt;/string&gt;<br class="">
                      &lt;key&gt;ServerEnabled&lt;/key&gt;<br class="">
                      &lt;false/&gt;<br class="">
                      &lt;key&gt;BindAddress&lt;/key&gt;<br class="">
                      &lt;string&gt;127.0.0.1&lt;/string&gt;<br class="">
                      &lt;key&gt;Port&lt;/key&gt;<br class="">
                      &lt;integer&gt;11211&lt;/integer&gt;<br class="">
                  &lt;/dict&gt;<br class="">
              &lt;/dict&gt;</div>
      <div class=""><br class="">
      </div>
      <div class="">Manually start memcached in verbose mode on
        127.0.0.1:</div>
      <div class="">memcached -l 127.0.0.1 -vv</div>
      <div class=""><br class="">
      </div>
      <div class="">Start calendar server, load a principal page: <a
          moz-do-not-send="true"
          href="https://whatever:8443/principals/users/you" class=""><a class="moz-txt-link-freetext" href="https://whatever:8443/principals/users/you">https://whatever:8443/principals/users/you</a></a></div>
      <div class=""><br class="">
      </div>
      <div class="">As you log in, you should see stuff in the memcached
        window:</div>
      <div class=""><br class="">
      </div>
      <div class="">&lt;22 new auto-negotiating client connection<br
          class="">
        22: Client using the <b class="">ascii protocol</b><br class="">
        &lt;22 get DIGESTCREDENTIALS:...</div>
      <div class="">&gt;22 END<br class="">
        <br class="">
      </div>
      <div class=""><br class="">
      </div>
      <div class="">Also try the following test script which sets and
        gets unicode strings. bytes. whatever they are :) In SVN mode, I
        run ./bin/python mctest.py from the SVN dir to make sure the
        interpreter has access to six and memcache. If you don't use SVN
        mode, and don't have these modules installed system-wide, edit
        PYTHONPATH to help your interpreter find these modules.</div>
      <div class=""><br class="">
      </div>
      <div class="">#!/usr/bin/python<br class="">
        # -*- coding: latin-1 -*-<br class="">
        from __future__ import print_function<br class="">
        <br class="">
        import six<br class="">
        from memcache import Client, SERVER_MAX_KEY_LENGTH,
        SERVER_MAX_VALUE_LENGTH<br class="">
        <br class="">
        servers = ["127.0.0.1:11211"]<br class="">
        mc = Client(servers, debug=1)<br class="">
        <br class="">
        def setget(key, val):<br class="">
            mc.set(key, val)<br class="">
            newval = mc.get(key)<br class="">
            print("key:", key)<br class="">
            print("set:".rjust(8), val)<br class="">
            print ("got:".rjust(8), newval, "\n")<br class="">
        <br class="">
        setget("ascii", "xyzzy")<br class="">
        <br class="">
        setget("unicode_1", six.u('\U0001f648'))<br class="">
        setget("unicode_2", six.u('\u25c9'))<br class="">
        setget("unicode_3", six.u('\u4f1a'))<br class="">
        setget("unicode_4", six.u('dr\\xe9'))<br class="">
        <br class="">
        mc.disconnect_all()<br class="">
        <br class="">
      </div>
      <div class=""><br class="">
      </div>
      <div class=""><br class="">
      </div>
      <div class="">Output looks like:</div>
      <div class=""><br class="">
      </div>
      <div class="">
        <div style="margin: 0px; font-size: 11px; line-height: normal;
          font-family: Menlo;" class="">key: ascii</div>
        <div style="margin: 0px; font-size: 11px; line-height: normal;
          font-family: Menlo;" class="">    set: xyzzy</div>
        <div style="margin: 0px; font-size: 11px; line-height: normal;
          font-family: Menlo;" class="">    got: xyzzy </div>
        <div style="margin: 0px; font-size: 11px; line-height: normal;
          font-family: Menlo; min-height: 13px;" class=""><br class="">
        </div>
        <div style="margin: 0px; font-size: 11px; line-height: normal;
          font-family: Menlo;" class="">key: unicode_1</div>
        <div style="margin: 0px; font-size: 11px; line-height: normal;
          font-family: Menlo;" class="">    set: 🙈</div>
        <div style="margin: 0px; font-size: 11px; line-height: normal;
          font-family: Menlo;" class="">    got: 🙈 </div>
        <div style="margin: 0px; font-size: 11px; line-height: normal;
          font-family: Menlo; min-height: 13px;" class=""><br class="">
        </div>
        <div style="margin: 0px; font-size: 11px; line-height: normal;
          font-family: Menlo;" class="">key: unicode_2</div>
        <div style="margin: 0px; font-size: 11px; line-height: normal;
          font-family: Menlo;" class="">    set: ◉</div>
        <div style="margin: 0px; font-size: 11px; line-height: normal;
          font-family: Menlo;" class="">    got: ◉ </div>
        <div style="margin: 0px; font-size: 11px; line-height: normal;
          font-family: Menlo; min-height: 13px;" class=""><br class="">
        </div>
        <div style="margin: 0px; font-size: 11px; line-height: normal;
          font-family: Menlo;" class="">key: unicode_3</div>
        <div style="margin: 0px; font-size: 11px; line-height: normal;
          font-family: Menlo;" class="">    set: 会</div>
        <div style="margin: 0px; font-size: 11px; line-height: normal;
          font-family: Menlo;" class="">    got: 会 </div>
        <div style="margin: 0px; font-size: 11px; line-height: normal;
          font-family: Menlo; min-height: 13px;" class=""><br class="">
        </div>
        <div style="margin: 0px; font-size: 11px; line-height: normal;
          font-family: Menlo;" class="">key: unicode_4</div>
        <div style="margin: 0px; font-size: 11px; line-height: normal;
          font-family: Menlo;" class="">    set: dré</div>
        <div style="margin: 0px; font-size: 11px; line-height: normal;
          font-family: Menlo;" class="">    got: dré </div>
      </div>
      <div style="margin: 0px; font-size: 11px; line-height: normal;
        font-family: Menlo;" class=""><br class="">
      </div>
      <div style="margin: 0px; font-size: 11px; line-height: normal;
        font-family: Menlo;" class=""><br class="">
      </div>
      <div style="margin: 0px; font-size: 11px; line-height: normal;
        font-family: Menlo;" class="">... and the memcached log confirms
        we're still in ascii mode:</div>
      <div style="margin: 0px; font-size: 11px; line-height: normal;
        font-family: Menlo;" class=""><br class="">
      </div>
      <div style="margin: 0px; line-height: normal;" class=""><font
          class="" face="Menlo"><span style="font-size: 11px;" class="">&lt;25
            new auto-negotiating client connection<br class="">
            25: Client using the ascii protocol<br class="">
            &lt;25 set ascii 0 0 5 <br class="">
            &gt;25 STORED<br class="">
            &lt;25 get ascii<br class="">
            &gt;25 sending key ascii<br class="">
            &gt;25 END<br class="">
            &lt;25 set unicode_1 0 0 4 <br class="">
            &gt;25 STORED<br class="">
            &lt;25 get unicode_1<br class="">
            &gt;25 sending key unicode_1<br class="">
            &gt;25 END<br class="">
          </span></font><br class="">
      </div>
      <div style="margin: 0px; font-size: 11px; line-height: normal;
        font-family: Menlo;" class=""><br class="">
      </div>
      <div style="margin: 0px; font-size: 11px; line-height: normal;
        font-family: Menlo;" class="">-dre</div>
    </blockquote>
    <br>
    Tried the experiment. Here is the output:<br>
    <br>
    root@wheezy:/tmp# python test.py <br>
    key: ascii<br>
        set: xyzzy<br>
        got: xyzzy <br>
    <br>
    key: unicode_1<br>
        set: 🙈<br>
        got: 🙈 <br>
    <br>
    key: unicode_2<br>
        set: ◉<br>
        got: ◉ <br>
    <br>
    key: unicode_3<br>
        set: 会<br>
        got: 会 <br>
    <br>
    key: unicode_4<br>
        set: dré<br>
        got: dré <br>
    <br>
    and here is the memcached log:<br>
    <br>
    &lt;37 new auto-negotiating client connection<br>
    37: Client using the ascii protocol<br>
    &lt;37 set ascii 0 0 5 <br>
    &gt;37 STORED<br>
    &lt;37 get ascii<br>
    &gt;37 sending key ascii<br>
    &gt;37 END<br>
    &lt;37 set unicode_1 0 0 4 <br>
    &gt;37 STORED<br>
    &lt;37 get unicode_1<br>
    &gt;37 sending key unicode_1<br>
    &gt;37 END<br>
    &lt;37 set unicode_2 0 0 3 <br>
    &gt;37 STORED<br>
    &lt;37 get unicode_2<br>
    &gt;37 sending key unicode_2<br>
    &gt;37 END<br>
    &lt;37 set unicode_3 0 0 3 <br>
    &gt;37 STORED<br>
    &lt;37 get unicode_3<br>
    &gt;37 sending key unicode_3<br>
    &gt;37 END<br>
    &lt;37 set unicode_4 0 0 4 <br>
    &gt;37 STORED<br>
    &lt;37 get unicode_4<br>
    &gt;37 sending key unicode_4<br>
    &gt;37 END<br>
    &lt;37 connection closed.<br>
    <br>
    <br>
    What next :)? I believe I could however safely go ahead and upload
    the new calendarserver version as this bug does not seem to breaking
    any functionality.<br>
    <br>
    Thanks,<br>
    Rahul.<br>
    <br>
    <br>
  </body>
</html>