PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Conversion in PHP
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Converts an ANSI or UNICODE string to UTF-8.
Example
MyUNICODEString is UNICODE string = "beginning"
// MyUNICODEString contains the set of bytes: 0064 00E9 0062 0075 0074
 
MyStringInUTF8 is Buffer = StringToUTF8(MyUNICODEString)
// MyStringInUTF8 contains the set of bytes: 64 C3 A9 62 75 74
// The character "é" was encoded in C3 A9
Syntax
<Result> = StringToUTF8(<String to convert> [, <Charset of string to convert>])
<Result>: Character string or Buffer
  • Character string or buffer in UTF-8 format,
  • EOT if conversion problems occurred.
<String to convert>: Character string (with quotes)
String to convert to UTF-8.
WEBDEV - Server code This string can correspond to:
  • an ANSI string in the current character set. The result will be an ANSI string containing the conversion to UTF-8.
  • an ANSI string in a specified character set. The result will be an ANSI string containing the conversion to UTF-8. This conversion takes the initial character set into account.
  • a UNICODE string. The result will be a buffer containing the conversion to UTF-8.
<Charset of string to convert>: Optional integer
Source character set of string to convert. By default, this parameter corresponds to the charsetCurrent constant (specified in ChangeCharset).
charsetAnsiRoman characters in ANSI standard
charsetArabicArabic characters
charsetBalticBaltic characters
charsetChineseChinese characters (People's Republic of China)
charsetTraditionalChineseTraditional Chinese characters (Republic of Taiwan)
charsetKoreanKorean characters
charsetCurrent
(Default value)
Uses the current character set specified with ChangeCharset (charsetOccidental by default)
charsetDefaultUses the computer's default character set. No character set is forced.
charsetEastEuropeEastern Europe characters (Polish, etc.)
charsetGreekGreek characters
charsetHebrewHebrew characters
charsetJapaneseJapanese characters
charsetRussianRussian characters
charsetThaiThai characters
charsetTurkishTurkish characters
charsetUTF8Used to manage UTF-8 (used in XML, for example).
charsetVietnameseVietnamese characters
Remarks
PHP

Conversion in PHP

The conversion in PHP uses the following extensions:
  • the php_iconv.dll extension
  • the php_mbstring.dll extension
If none of these PHP extensions are used, only Latin characters will be converted (e.g., Chinese or Russian characters will not be converted).
The php_iconv.dll and php_mbstring.dll extensions are currently proposed on PHP servers. To find out if your hosting provider offers these extensions, simply enter the following information in a search engine: phpinfo <Hosting provider>.
To install these extensions on your own PHP server, simply uncomment the desired extension in the PHP.INI file.
Component: wd260vm.dll
Minimum version required
  • Version 10
This page is also available for…
Comments
XML COM ACENTUAÇÃO
s_xml is string=[
<?xml version="1.0" encoding="utf-8"?>
<consMDFeNaoEnc xmlns="http://www.portalfiscal.inf.br/mdfe" versao="1.00">
<tpAmb>2</tpAmb>
<xServ>CONSULTAR NÃO ENCERRADOS</xServ>
<CNPJ>00397887000101</CNPJ>
</consMDFeNaoEnc>
]
fSaveText("C:\TEMP\XML_ACENTO.xml",StringToUTF8(s_xml))

// BLOG COM VIDEO E EXEMPLO

http://windevdesenvolvimento.blogspot.com.br/2017/08/aula-1228-windev-string-40-stringtoutf8.html

https://www.youtube.com/watch?v=mhlb_WwDymk

De matos
01 Aug. 2017