Skip to content

Commit 417c906

Browse files
authored
Merge pull request #63 from kurz-m/main
Fix typo in 01-zig-weird.qmd
2 parents 0433146 + 60715ca commit 417c906

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

Chapters/01-zig-weird.qmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,7 @@ const object: []const u8 = "A string object";
10631063
```
10641064

10651065
Zig always assumes that this sequence of bytes is UTF-8 encoded. This might not be true for every
1066-
sequence of bytes you have it, but is not really Zig's job to fix the encoding of your strings
1066+
sequence of bytes you're working with, but is not really Zig's job to fix the encoding of your strings
10671067
(you can use [`iconv`](https://www.gnu.org/software/libiconv/)[^libiconv] for that).
10681068
Today, most of the text in our modern world, especially on the web, should be UTF-8 encoded.
10691069
So if your string literal is not UTF-8 encoded, then, you will likely

_freeze/Chapters/01-zig-weird/execute-results/html.json

+2-2
Large diffs are not rendered by default.

docs/Chapters/01-zig-weird.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ <h2 data-number="1.8" class="anchored" data-anchor-id="sec-zig-strings"><span cl
777777
<span id="cb44-3"><a href="#cb44-3" aria-hidden="true" tabindex="-1"></a><span class="co">// This is a string object:</span></span>
778778
<span id="cb44-4"><a href="#cb44-4" aria-hidden="true" tabindex="-1"></a><span class="kw">const</span> object: []<span class="kw">const</span> <span class="dt">u8</span> = <span class="st">"A string object"</span>;</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
779779
</div>
780-
<p>Zig always assumes that this sequence of bytes is UTF-8 encoded. This might not be true for every sequence of bytes you have it, but is not really Zig’s job to fix the encoding of your strings (you can use <a href="https://www.gnu.org/software/libiconv/"><code>iconv</code></a><a href="#fn16" class="footnote-ref" id="fnref16" role="doc-noteref"><sup>16</sup></a> for that). Today, most of the text in our modern world, especially on the web, should be UTF-8 encoded. So if your string literal is not UTF-8 encoded, then, you will likely have problems in Zig.</p>
780+
<p>Zig always assumes that this sequence of bytes is UTF-8 encoded. This might not be true for every sequence of bytes you’re working with, but is not really Zig’s job to fix the encoding of your strings (you can use <a href="https://www.gnu.org/software/libiconv/"><code>iconv</code></a><a href="#fn16" class="footnote-ref" id="fnref16" role="doc-noteref"><sup>16</sup></a> for that). Today, most of the text in our modern world, especially on the web, should be UTF-8 encoded. So if your string literal is not UTF-8 encoded, then, you will likely have problems in Zig.</p>
781781
<p>Let’s take for example the word “Hello”. In UTF-8, this sequence of characters (H, e, l, l, o) is represented by the sequence of decimal numbers 72, 101, 108, 108, 111. In xecadecimal, this sequence is <code>0x48</code>, <code>0x65</code>, <code>0x6C</code>, <code>0x6C</code>, <code>0x6F</code>. So if I take this sequence of hexadecimal values, and ask Zig to print this sequence of bytes as a sequence of characters (i.e.&nbsp;a string), then, the text “Hello” will be printed into the terminal:</p>
782782
<div class="cell">
783783
<div class="sourceCode cell-code" id="cb45"><pre class="sourceCode zig code-with-copy"><code class="sourceCode zig"><span id="cb45-1"><a href="#cb45-1" aria-hidden="true" tabindex="-1"></a><span class="kw">const</span> std = <span class="bu">@import</span>(<span class="st">"std"</span>);</span>

docs/search.json

+1-1
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)