Announcement

Collapse
No announcement yet.

Asciiz having unicode

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Michael Mattias
    replied
    Minor detail as to read-ability...you may want a constant to indicate "*2" just for future reference so that you remember 1byte vs 2byte "strings
    Now that you don't have to send email and can submit NFSs on-line, why don't you send in the one I sent in a long time ago via email...

    " Please add a new datatype to directly support Wide Character (Unicode) strings and build automatic support into related functions (eg assignment of string literal to STRINGW data type automatically does the "UCODE$() against it, etc.)"

    .. and get yourself the much-coveted "checkmark?"

    Leave a comment:


  • Cliff Nichols
    replied
    Minor detail as to read-ability...you may want a constant to indicate "*2" just for future reference so that you remember 1byte vs 2byte "strings"

    Leave a comment:


  • Edwin Knoppert
    replied
    Thank you, perfect..

    I forgot to use size * 2

    See you next time... for the same question

    Leave a comment:


  • José Roca
    replied
    Code:
    ' ========================================================================================
    ' Extracts the contents of a null-terminated unicode string, given its address, and
    ' converts it to Ansi. These kind of strings are allocated with CoTaskMemAlloc or IMalloc
    ' and freed with CoTaskMemFree. If the optional parameter CodePage is present, it
    ' represents the code page to be used for the conversion process. If not given, the
    ' default code page for the locale of the executing computer is used.
    ' ========================================================================================
    FUNCTION W2A_ (BYVAL pwstr AS DWORD, OPTIONAL BYVAL nCodePage AS LONG) AS STRING
       LOCAL ln AS LONG
       IF pwstr = %NULL THEN EXIT FUNCTION
       ln = lstrlenW(BYVAL pwstr)
       IF ln THEN FUNCTION = ACODE$(PEEK$(pwstr, ln * 2), nCodePage)
    END FUNCTION
    ' ========================================================================================
    Last edited by José Roca; 10 Jul 2009, 02:17 PM.

    Leave a comment:


  • José Roca
    replied
    Use lstrlenW to retrieve the length.

    Leave a comment:


  • Edwin Knoppert
    replied
    lstrlenw() does not give me a complete string unf.

    Leave a comment:


  • Edwin Knoppert
    started a topic Asciiz having unicode

    Asciiz having unicode

    I have this call giving me an unicode string but it is asciiz and has no length param.
    Dare devil as i was i forced it with acode$( peek$(... 4 ) ) and i saw a part of the string.
    I remember me asking this before but i forgot how to succesfully squeeze the unicode string out of the asciiz
Working...
X