Lines Matching full:docutils
94 <tt class="docutils literal"><span class="pre">????</span></tt> characters or have written some Pyt…
95 such as <tt class="docutils literal"><span class="pre">UnicodeDecodeError:</span> <span class="pre"…
105 unwanted <tt class="docutils literal"><span class="pre">?</span></tt> characters and <tt class="doc…
126 character is assigned a <em>code point</em>. For example the word <tt class="docutils literal"><spa…
127 from code points <tt class="docutils literal"><span class="pre">U+0048</span> <span class="pre">U+0…
148 <li><dl class="first docutils">
180 <tt class="docutils literal"><span class="pre">unicode</span></tt> type. Under the hood, Python rep…
182 <p>The <tt class="docutils literal"><span class="pre">unicode()</span></tt> constructor has the sig…
199 <p>The <tt class="docutils literal"><span class="pre">errors</span></tt> argument specifies what to…
200 ascii. Legal values for this argument are <tt class="docutils literal"><span class="pre">'strict'</…
201 <tt class="docutils literal"><span class="pre">UnicodeDecodeError</span></tt> exception), <tt class…
202 can't be decoded with another one), or <tt class="docutils literal"><span class="pre">'ignore'</spa…
223 that the ASCII codec cannot decode the byte <tt class="docutils literal"><span class="pre">0x80</sp…
224 because it is not in the range(128) or 0-127. In fact <tt class="docutils literal"><span class="pre…
226 …docutils literal"><span class="pre">0x80</span></tt> is encoded with the <tt class="docutils liter…
227 <tt class="docutils literal"><span class="pre">'8859'</span></tt> character sets (which incidentall…
238 strings provide. Python will try to use the <tt class="docutils literal"><span class="pre">'ascii'<…
257 … class="docutils literal"><span class="pre">"</span></tt>, <tt class="docutils literal"><span clas…
262 </textarea><p>Specific code points can be written using the <tt class="docutils literal"><span clas…
263 followed by four hex digits giving the code point. If you use <tt class="docutils literal"><span cl…
265 …as 8-bit strings, including <tt class="docutils literal"><span class="pre">\x</span></tt>, but <tt…
267 characters to Unicode strings using the <tt class="docutils literal"><span class="pre">unichr()</sp…
268 out what the ordinal is with <tt class="docutils literal"><span class="pre">ord()</span></tt>.</p>
317 <tt class="docutils literal"><span class="pre">File->Encoding</span></tt>.</p>
322 the <tt class="docutils literal"><span class="pre">unicodedata</span></tt> module which can be used…
339 built-in support in the form of the <tt class="docutils literal"><span class="pre">codecs</span></t…
340 <p>The codecs module includes a version of the <tt class="docutils literal"><span class="pre">open(…
342 encoding and accepts Unicode parameters for methods such as <tt class="docutils literal"><span clas…
343 <tt class="docutils literal"><span class="pre">.write()</span></tt>.</p>
345 errors='strict', buffering=1). <tt class="docutils literal"><span class="pre">mode</span></tt> can …
346 corresponding parameter to the regular built-in <tt class="docutils literal"><span class="pre">open…
347 add a <tt class="docutils literal"><span class="pre">+</span></tt> character to update the file. <t…
348 standard function's parameter. <tt class="docutils literal"><span class="pre">encoding</span></tt> …
349 use, if not specified or specified as <tt class="docutils literal"><span class="pre">None</span></t…
352 as needed. <tt class="docutils literal"><span class="pre">errors</span></tt> specifies the action f…
353 …="docutils literal"><span class="pre">'strict'</span></tt>, <tt class="docutils literal"><span cla…
369 </textarea><p>Notice that we used the <tt class="docutils literal"><span class="pre">repr()</span><…
373 error might be raised. This is avoided if you use <tt class="docutils literal"><span class="pre">re…
374 <p>The Unicode character <tt class="docutils literal"><span class="pre">U+FEFF</span></tt> is used …
394 <p>On Windows 9x, the encoding is <tt class="docutils literal"><span class="pre">mbcs</span></tt>.<…
395 <p>On Mac OS X, the encoding is <tt class="docutils literal"><span class="pre">utf-8</span></tt>.</…
399 getfilesystemencoding still returns <tt class="docutils literal"><span class="pre">mbcs</span></tt>…
402 <p><tt class="docutils literal"><span class="pre">mbcs</span></tt> is a special encoding for Window…
404 the system encoding with <tt class="docutils literal"><span class="pre">sys.getfilesystemencoding()…
411 </textarea><p>Other functions such as <tt class="docutils literal"><span class="pre">os.listdir()</…
413 string. For example running this example as <tt class="docutils literal"><span class="pre">test.py<…
441 <p>If you fail to do this you will find that <tt class="docutils literal"><span class="pre">Unicode…
475 could pass <tt class="docutils literal"><span class="pre">L2V0Yy9wYXNzd2Q=</span></tt> which is the…
476 <tt class="docutils literal"><span class="pre">'/etc/passwd'</span></tt> which is a file you clearl…
477 hold of. The above code looks for <tt class="docutils literal"><span class="pre">/</span></tt> cha…
483 <p>Currently the Pylons input values come from <tt class="docutils literal"><span class="pre">reque…
524 including in <tt class="docutils literal"><span class="pre">m.write()</span></tt> and <tt class="do…
525 Pylons' <tt class="docutils literal"><span class="pre">render_response()</span></tt> and <tt class=…
528 encoding to use by editing your project's <tt class="docutils literal"><span class="pre">config/env…
535 </textarea><p>replacing <tt class="docutils literal"><span class="pre">UTF-8</span></tt> with the e…
544 the very least, that means you should specify the following in the <tt class="docutils literal"><sp…
549 <p>You should also set the charset in the <tt class="docutils literal"><span class="pre">Content-Ty…
555 character set, you can set the encoding by adding the <tt class="docutils literal"><span class="pre…
569 prepared to accept UTF-8 by decoding the data in <tt class="docutils literal"><span class="pre">req…
605 languages you wrap them in the <tt class="docutils literal"><span class="pre">_()</span></tt> funct…
610 …ss="last">The <tt class="docutils literal"><span class="pre">_()</span></tt> function is a referen…
611 <tt class="docutils literal"><span class="pre">_()</span></tt> is a convention for marking text to …
612 <tt class="docutils literal"><span class="pre">ugettext()</span></tt> is the Unicode version of <tt…
614 <p>In our example we want the string <tt class="docutils literal"><span class="pre">'Hello'</span><…
616 <tt class="docutils literal"><span class="pre">'Hello'</span></tt> in the default language. We'll t…
618 <p>Lets call our project <tt class="docutils literal"><span class="pre">translate_demo</span></tt>:…
627 <p>Edit <tt class="docutils literal"><span class="pre">controllers/hello.py</span></tt> controller …
628 <tt class="docutils literal"><span class="pre">_()</span></tt> function everywhere where the string…
651 </textarea><p>The controller has now been internationalized but it will raise a <tt class="docutils…
660 translation functions, such as <tt class="docutils literal"><span class="pre">_()</span></tt>. This…
662 translations. This is the <tt class="docutils literal"><span class="pre">.pot</span></tt> file.</bl…
666 the list of messages are translated and saved as a <tt class="docutils literal"><span class="pre">.…
671 the <tt class="docutils literal"><span class="pre">.mo</span></tt> file. Compiling the translations…
675 the extraction of strings and production of a <tt class="docutils literal"><span class="pre">.mo</s…
679 may use whichever you prefer but <tt class="docutils literal"><span class="pre">xgettext</span></tt…
700 <p>To use poEdit with the <tt class="docutils literal"><span class="pre">translate_demo</span></tt>…
703 …docutils literal"><span class="pre">Project</span> <span class="pre">Info</span></tt> tab, enter t…
710 the <tt class="docutils literal"><span class="pre">.mo</span></tt> file produced to <tt class="docu…
711 <tt class="docutils literal"><span class="pre">translate_demo/i18n/es/LC_MESSAGES</span></tt> direc…
713 … process of creating a <tt class="docutils literal"><span class="pre">.mo</span></tt> file for the…
714 <tt class="docutils literal"><span class="pre">es</span></tt> and <tt class="docutils literal"><spa…
715 <p>The relevant lines from <tt class="docutils literal"><span class="pre">i18n/en/LC_MESSAGES/trans…
721 <p>The relevant lines from <tt class="docutils literal"><span class="pre">i18n/es/LC_MESSAGES/trans…
727 <p>The relevant lines from <tt class="docutils literal"><span class="pre">i18n/fr/LC_MESSAGES/trans…
733 <p>Whichever tools you use you should end up with an <tt class="docutils literal"><span class="pre"…
765 session and set in your controller's <tt class="docutils literal"><span class="pre">__before__()</s…
772 used in the configuration file. Just add a <tt class="docutils literal"><span class="pre">lang</spa…
773 code of the language you wanted to use in your <tt class="docutils literal"><span class="pre">devel…
774 example to set the default language to Spanish you would add <tt class="docutils literal"><span cla…
775 your <tt class="docutils literal"><span class="pre">development.ini</span></tt>. The relevant part …
781 </textarea><p>If you are running the server with the <tt class="docutils literal"><span class="pre"…
782 automatically restart if you change the <tt class="docutils literal"><span class="pre">development.…
793 <p>If your code calls <tt class="docutils literal"><span class="pre">_()</span></tt> with a string …
794 catalogue, the string passed to <tt class="docutils literal"><span class="pre">_()</span></tt> is r…
810 <p>This is because we never provided a translation for the string <tt class="docutils literal"><spa…
815 <p>You can also use the <tt class="docutils literal"><span class="pre">_()</span></tt> function wit…
819 </textarea><p>would produce the string <tt class="docutils literal"><span class="pre">'Hello'</span…
820 <p>There is one complication though. gettext's <tt class="docutils literal"><span class="pre">xgett…
821 strings that need translating from Python code in <tt class="docutils literal"><span class="pre">.p…
822 that if you write <tt class="docutils literal"><span class="pre">_('Hello')</span></tt> in a templa…
823 <tt class="docutils literal"><span class="pre">xgettext</span></tt> will not find the string <tt cl…
825 <p>As long as <tt class="docutils literal"><span class="pre">xgettext</span></tt> can find a string…
830 file in <tt class="docutils literal"><span class="pre">lib</span></tt> with an appropriate filename…
832 translation tool can then extract the strings in <tt class="docutils literal"><span class="pre">lib…
834 <p>For example if you wanted to ensure the translated string <tt class="docutils literal"><span cla…
835 was available in all templates you could create a <tt class="docutils literal"><span class="pre">li…
861 <p>The <tt class="docutils literal"><span class="pre">setup.py</span></tt> automatically includes t…
863 is done with the following line in your <tt class="docutils literal"><span class="pre">setup.py</sp…
868 directly from the egg without the need for <tt class="docutils literal"><span class="pre">easy_inst…
872 <p>Pylons also defines <tt class="docutils literal"><span class="pre">ungettext()</span></tt> and <…
873 from <tt class="docutils literal"><span class="pre">pylons.i18n</span></tt>. They are designed for …
884 headers to the <tt class="docutils literal"><span class="pre">.po</span></tt> files for the languag…