Last active
May 3, 2018 08:56
-
-
Save hlassiege/bc14e4cbbb86f5ca6cf4535ea74c73c0 to your computer and use it in GitHub Desktop.
unicode python 2.x
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword; CharSet=UTF8; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$number = 1234.56; | |
// Notation anglaise (par défaut) | |
$english_format_number = number_format($number); | |
// 1,235 Notation française | |
$nombre_format_francais = number_format($number, 2, ',', ' '); | |
// 1 234,56 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import locale | |
import datetime | |
locale.setlocale( locale.LC_ALL, 'en_US' ) | |
// va afficher : '$188518982.18' | |
locale.currency( 188518982.18 ) | |
// va afficher '1,255,000' | |
locale.format("%d", 1255000, grouping=True) | |
// va afficher '12/13/2011 12:00:00 AM' | |
today=datetime.date.today() | |
today.strftime('%c') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CultureInfo ci = CultureInfo.CurrentCulture; | |
string money = 120.ToString(“c”,ci); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string myDate = DateTime.Now.ToString(ci); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_once 'I18Nv2.php'; | |
$locale = &I18Nv2::createLocale('en_US'); | |
echo "Format a currency value of 2000: ", | |
$locale->formatCurrency(2000, I18Nv2_CURRENCY_INTERNATIONAL), "\n"; | |
echo "Format todays date: ", | |
$locale->formatDate(null, I18Nv2_DATETIME_FULL), "\n"; | |
echo "Format number : ", | |
$locale->formatNumber(1234.56), "\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Culture culture = CultureInfo.CurrentCulture ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
locale_get_default() | |
// ou | |
Locale::getDefault() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
l = locale.getdefaultlocale() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ResourceBundle rb = ResourceBundle.getBundle("myBundle", currentLocale); | |
String message = rb.getString("string1"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$rb = new ResourceBundle('root', "./locale"); | |
echo resourcebundle_get($rb, 'string1'); | |
ou | |
echo $r->get('string1'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gettext | |
print _("Hello, World!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unicodeString = u"hello Unicode world!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | |
ou en HTML5 | |
<meta charset="UTF-8"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p dir="LTR">שלם</p> | |
<p dir="RTL">שלם</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jdbc:mysql://localhost/some_db?useUnicode=yes&characterEncoding=UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql_connect("serveur","login","pass"); | |
mysql_select_db("myDbUtf8"); | |
mysql_query("SET NAMES 'utf8'"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import MySQLdb | |
db = MySQLdb.connect(host=DB_HOST ,user=DB_USER ,passwd=DB_PASS,db=DB_NAME, charset = "utf8", use_unicode = True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NumberFormat nf = NumberFormat.getInstance(); // pour utiliser la Locale courante | |
ou | |
NumberFormat nf = NumberFormat.getInstance(Locale.FRENCH); // pour spécifier une Locale | |
myNumber = nf.parse(myString); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NumberFormat nf = NumberFormat.getCurrencyInstance(); | |
nf.format(1234.56); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DateFormat df = DateFormat.getDateInstance(); | |
myDate = df.parse(myString); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? header('Content-Type: text/html; charset=utf-8'); ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo $myTransations[‘string1’]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_once 'langs/'.$lang.'.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment