| 
	
		|  Autor | Tema: Como convertir Unicode a ascii  (Leído 7,325 veces) |  
	| 
			| 
					
						| thecirujano 
								
								 Desconectado 
								Mensajes: 33
								
								
								
								
								
								   | 
 
Como puedo convertir un string unicode a ascii? 
 
 |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  | 
			| 
					
						| Psyke1 
								Wiki  Desconectado 
								Mensajes: 1.089
								
								     | 
 
Busca:StrConv() DoEvents!  
 
 |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  | 
			| 
					
						| thecirujano 
								
								 Desconectado 
								Mensajes: 33
								
								
								
								
								
								   | 
 
s = StrConv(Buffer, vbUnicode)creo que me explique mal lo tengo así y me devuelve caracteres ilegibles, luego le aplique un strptr(s) y ahora me devuelve un valor numérico.
 Sabes algun tipo de transformacion que me pueda ser util, lo estoy utilizando para leer la respuesta de una impresora conectada mediante bluetooth
 |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  | 
			| 
					
						| raul338 
								       
								
								 Desconectado 
								Mensajes: 2.633
								
								 
								La sonrisa es la mejor forma de afrontar las cosas
								
								
								
								
								
								     | 
 
s = StrConv(Buffer, vbFromUnicode) Sino una mas burda Dim chars() as ByteDim sUnicode as StringDim sAscii as string' Asignas sUnicodechars = StrConv(sUnicode, vbUnicode)sAscii = StrConv(chars, vbFromUnicode) 
 Puedes ir variando |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  | 
			| 
					
						| LeandroA | 
 
hola quizas sea Unicode a UTF8 o al revez Option Explicit
 Private Declare Function WideCharToMultiByte Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long, ByRef lpMultiByteStr As Any, ByVal cchMultiByte As Long, ByVal lpDefaultChar As String, ByVal lpUsedDefaultChar As Long) As Long
 Private Declare Function MultiByteToWideChar Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByRef lpMultiByteStr As Any, ByVal cchMultiByte As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long) As Long
 Private Const CP_UTF8                   As Long = 65001
 
 Public Function UTF82Unicode(ByVal sUTF8 As String) As String
 Dim UTF8Size        As Long
 Dim BufferSize      As Long
 Dim BufferUNI       As String
 Dim LenUNI          As Long
 Dim bUTF8()         As Byte
 
 If LenB(sUTF8) = 0 Then Exit Function
 
 bUTF8 = StrConv(sUTF8, vbFromUnicode)
 UTF8Size = UBound(bUTF8) + 1
 
 BufferSize = UTF8Size * 2
 BufferUNI = String$(BufferSize, vbNullChar)
 
 LenUNI = MultiByteToWideChar(CP_UTF8, 0, bUTF8(0), UTF8Size, StrPtr(BufferUNI), BufferSize)
 
 If LenUNI Then UTF82Unicode = Left$(BufferUNI, LenUNI)
 
 End Function
 
 
 Public Function Unicode2UTF8(ByVal strUnicode As String) As String
 Dim LenUNI          As Long
 Dim BufferSize      As Long
 Dim LenUTF8         As Long
 Dim bUTF8()         As Byte
 
 LenUNI = Len(strUnicode)
 
 If LenUNI = 0 Then Exit Function
 
 BufferSize = LenUNI * 3 + 1
 ReDim bUTF8(BufferSize - 1)
 
 LenUTF8 = WideCharToMultiByte(CP_UTF8, 0, StrPtr(strUnicode), LenUNI, bUTF8(0), BufferSize, vbNullString, 0)
 
 If LenUTF8 Then
 ReDim Preserve bUTF8(LenUTF8 - 1)
 Unicode2UTF8 = StrConv(bUTF8, vbUnicode)
 End If
 
 End Function
 |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  |  |  
 
	
 
 
				
					
						| Mensajes similares |  
						|  | Asunto | Iniciado por | Respuestas | Vistas | Último mensaje |  
						|   |   | Convertir caracter a ASCII Programación Visual Basic
 | X-TN | 6 | 19,223 |  10 Junio 2006, 19:16 pm por soplo
 |  
						|   |   | IMPOSIBLE convertir de Hex a ASCII este código
							« 1 2 » Hacking Wireless
 | guillegf84 | 11 | 9,446 |  20 Octubre 2011, 15:32 pm por ChimoC
 |  
						|   |   | Duda con Ascii Unicode, Ansi Ingeniería Inversa
 | .:UND3R:. | 6 | 8,151 |  10 Marzo 2014, 18:44 pm por Gh057
 |  
						|   |   | UNICODE ASCII C/C++ [Save in File] Ayuda ? Programación C/C++
 | Citrusl | 5 | 3,492 |  24 Noviembre 2014, 01:59 am por engel lex
 |  
						|   |   | (Ayuda) Inconcluencias entre código ASCII y UNICODE Java
 | Seyro97 | 7 | 7,125 |  25 Febrero 2019, 02:43 am por palsot
 |    |