Load an SQL script to a memo

Posted on 2004-11-08
Last Modified: 2012-05-05
I try to load an sql script into an memo but all I get in the memo is some strange characters:


Can someone tell me how to do.
Question by:pucko
    LVL 27

    Expert Comment

    where comes the script from?
    LVL 1

    Author Comment

    Generated from an Microsoft SQL server.

    I think the problem is that it's in unicode. ( that's what notepad says if I open it and save it.)

    And it looks ok in an TntMemo. (but I prefere to use an TMemo in this case.

    So I guess that the Question should be how to convert unicode to ansi string.
    LVL 6

    Expert Comment

    you cannot
    all Delphi VCL is not unicode compliant
    just use TntMemo
    LVL 1

    Author Comment

    What do you mean?  It must be possible to convert an unicode text to an ansi text? (and the reverse).

    And why should the DELPHI vcl have to be Unicode compilant to write an Unicode to ansi routine?
    LVL 1

    Expert Comment

    There's always ways of converting things :)  You've just got to know what you're converting from first :)

    Try this function:


    from the Help:
    Converts Unicode characters to single or multi byte character data.

    LVL 4

    Accepted Solution

    or use  WideCharToString if the unicode string  is null-terminated

    also from the help file

    WideCharToString converts the given null-terminated Unicode string to a string made up of single- or multi-byte characters.
    LVL 4

    Expert Comment

    thank you for the points.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
    Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now