Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Uwe Heyer" Newsgroups: comp.lang.clipper.visual-objects Subject: Re: create txt file with utf-8 Date: 16 Oct 2015 20:18:44 GMT Lines: 65 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Trace: individual.net yGUfwoxADS3JX7y/01vZiAMcND96th/bEZjK6t1WWyKmjAIsyz Cancel-Lock: sha1:HndEh1s4q5+JTFIdALnxLg+De4w= User-Agent: XanaNews/1.18.1.6 Xref: csiph.com comp.lang.clipper.visual-objects:8529 moshe attia wrote: > hi > it create txt file > and write the data in the file > i need to write the file at utf-8 format > > . > the project dump dbf file to svc > and import the svc to mysql . > > when i import the file i recive at varchar ????????? > > > moshe -- Hi moshe, you need a convert to wide_char first MultiByteToWideChar(CP_ACP, ....) second, convert above result to multi_byte WideCharToMultiByte(CP_UTF8, ...) first of both calls is the compute of needed spaces see below (an example in Power Basic) ' Konvertiert ANSI nach UTF-8 FUNCTION PBAnsiToUtf8(BYVAL sString AS STRING) EXPORT AS STRING LOCAL sBuffer AS STRING LOCAL nLength AS LONG nLength = MultiByteToWideChar(%CP_ACP, 0, BYVAL STRPTR(sString), -1, BYVAL 0, 0) sBuffer = NUL$(nLength * 2) MultiByteToWideChar(%CP_ACP, 0, BYVAL STRPTR(sString), -1, BYVAL STRPTR(sBuffer), nLength) nLength = WideCharToMultiByte(%CP_UTF8, 0, BYVAL STRPTR(sBuffer), -1, BYVAL 0, 0, BYVAL (0), BYVAL (0)) sString = NUL$(nLength) WideCharToMultiByte(%CP_UTF8, 0, BYVAL STRPTR(sBuffer), -1, BYVAL STRPTR(sString), nLength, BYVAL (0), BYVAL (0)) FUNCTION = LEFT$(sString, LEN(sString) - 1) END FUNCTION Ahoj -Uwe