Skip to content

Instantly share code, notes, and snippets.

@hlassiege
hlassiege / jdbcurl.txt
Created May 3, 2018 09:30
jdbcurl.txt
jdbc:mysql://localhost/some_db?useUnicode=yes&characterEncoding=UTF-8
@hlassiege
hlassiege / htmldirection.html
Created May 3, 2018 09:30
htmldirection.html
<p dir="LTR">שלם</p>
<p dir="RTL">שלם</p>
@hlassiege
hlassiege / htmlcharset.txt
Created May 3, 2018 09:30
htmlcharset.txt
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
ou en HTML5
<meta charset="UTF-8">
$utf8key = utf8_encode($key);
...
$len = mb_strlen($utf8key, 'utf-8');
ou
$len = mb_strlen($utf8key); // si l’encodage a été correctement paramétré pour le module mbstring
unicodeString = u"hello Unicode world!"
@hlassiege
hlassiege / gettext.py
Last active May 3, 2018 09:29
gettext.py
import gettext
print _("Hello, World!")
@hlassiege
hlassiege / getstring.php
Created May 3, 2018 09:29
getstring.php
$rb = new ResourceBundle('root', "./locale");
echo resourcebundle_get($rb, 'string1');
ou
echo $r->get('string1');
@hlassiege
hlassiege / getstring.java
Created May 3, 2018 09:29
getstring.java
ResourceBundle rb = ResourceBundle.getBundle("myBundle", currentLocale);
String message = rb.getString("string1");
@hlassiege
hlassiege / getdefaultlocale.py
Created May 3, 2018 09:28
getdefaultlocale.py
l = locale.getdefaultlocale()
@hlassiege
hlassiege / getdefaultlocale.php
Created May 3, 2018 09:28
getdefaultlocale.php
locale_get_default()
// ou
Locale::getDefault()