<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Tianqi Li</title>
    <description>The latest articles on DEV Community by Tianqi Li (@tianqi_li_36622465630de8c).</description>
    <link>https://dev.to/tianqi_li_36622465630de8c</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4253082%2F298d627e-3a7b-4be6-a663-25886e9e09a7.png</url>
      <title>DEV Community: Tianqi Li</title>
      <link>https://dev.to/tianqi_li_36622465630de8c</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tianqi_li_36622465630de8c"/>
    <language>en</language>
    <item>
      <title>How a German browser quiz decides whether Koeln means Köln</title>
      <dc:creator>Tianqi Li</dc:creator>
      <pubDate>Thu, 19 Nov 2026 06:09:25 +0000</pubDate>
      <link>https://dev.to/tianqi_li_36622465630de8c/how-a-german-browser-quiz-decides-whether-koeln-means-koln-nm</link>
      <guid>https://dev.to/tianqi_li_36622465630de8c/how-a-german-browser-quiz-decides-whether-koeln-means-koln-nm</guid>
      <description>&lt;p&gt;&lt;code&gt;KÖLN&lt;/code&gt; and &lt;code&gt;Köln&lt;/code&gt; should receive the same result in a timed quiz. So should a version of &lt;code&gt;Köln&lt;/code&gt; in which the umlaut is stored as a combining character. &lt;code&gt;Koeln&lt;/code&gt; takes a different decision. It is a spelling the quiz can explicitly accept for that city. And if a future question contains both &lt;code&gt;Maße&lt;/code&gt; and &lt;code&gt;Masse&lt;/code&gt;, the matcher needs to keep those words apart.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://krillion.de/" rel="noopener noreferrer"&gt;Krillion auf Deutsch&lt;/a&gt; is an independent fan-made browser quiz with original German-language questions. Each question gives players 25 seconds to enter a correct answer. Here is how its answer matcher separates equivalent text from spellings that require a decision by the question author.&lt;/p&gt;

&lt;h2&gt;
  
  
  Normalize the representation
&lt;/h2&gt;

&lt;p&gt;The game normalizes both the input and the expected answer to Unicode NFC and then lowercases them using the German locale. It also tidies surrounding whitespace, repeated internal whitespace and trailing sentence punctuation. That handles cases where keyboards or copy and paste produce different representations of the same text. NFC leaves the umlaut intact, so a plain &lt;code&gt;o&lt;/code&gt; stays distinct from &lt;code&gt;ö&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This JavaScript example isolates the Unicode part of that behavior:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;normalize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'NFC'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLocaleLowerCase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'de'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;assert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;key&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'KÖLN'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nf"&gt;key&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Köln'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;assert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;key&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Ko\u0308ln'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nf"&gt;key&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Köln'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;assert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;key&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Koln'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="nf"&gt;key&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Köln'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Keep aliases with the answers they name
&lt;/h2&gt;

&lt;p&gt;Each accepted answer carries its canonical spelling and can also carry explicit aliases. The matcher compares normalized input against both. When &lt;code&gt;Koeln&lt;/code&gt; matches an alias, the match refers to the canonical answer &lt;code&gt;Köln&lt;/code&gt;; it does not need a separate entry or score. The matcher reports whether it matched an alias, so the interface can show the stored spelling if the player has enabled spelling confirmation.&lt;/p&gt;

&lt;p&gt;A general replacement rule would be harder to reason about. Automatically rewriting every &lt;code&gt;ß&lt;/code&gt; to &lt;code&gt;ss&lt;/code&gt;, for instance, makes &lt;code&gt;Maße&lt;/code&gt; and &lt;code&gt;Masse&lt;/code&gt; collide. An explicit alias can still allow &lt;code&gt;Strasse&lt;/code&gt; for &lt;code&gt;Straße&lt;/code&gt; where that spelling makes sense. The scope of the decision stays with one answer to one question.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test the boundary with near misses
&lt;/h2&gt;

&lt;p&gt;The project's test suite checks that capital letters and a combining umlaut both work, that &lt;code&gt;Koeln&lt;/code&gt; resolves as an alias, and that &lt;code&gt;Koln&lt;/code&gt; is rejected when it has not been added. It separately checks that &lt;code&gt;Masse&lt;/code&gt; does not get accepted for &lt;code&gt;Maße&lt;/code&gt;. Positive cases protect the forgiving input experience. Negative cases protect the meaning of the question.&lt;/p&gt;

&lt;p&gt;If you add this approach to a quiz of your own, check for aliases that normalize to the same key within a question. A matcher that returns the first hit would otherwise assign an ambiguous input according to answer order. Test both the spelling variants you mean to accept and nearby inputs you mean to reject before the question enters rotation.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;AI disclosure: This article was generated with AI and checked against the project source and its matching tests.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
