Basic VSP Programming tutorial
Emitting Output to the User Agent How to send data to the user-agents

## Preliminaries

- The Virtuoso Web server writes the content that is to be sent into the internal string session.
- The internal string session will be sent to the user-agent after VSP execution (if there is no unhandled SQL errors).
- There is full control over an internal session. It can be cleared, filled and flushed. Note when flushing an internal session the task will be executed in background, and no output will be sent after this action.
- The character data can be encoded in various ways. A default encoding (CharSet) can be defined in the database INI file

## HTTP session control functions

- http() - writes a string into the internal string session without conversion.
- http_value() - writes a string with escapes into the internal string session.
- http_rewrite() - clears the internal string session
- http_flush() - flushes the internal string to the user-agent and continues processing in background.
- <?=var ?> - a shortcut to write a variable (or function) from an HTML section.

## HTTP formatting and charset functions

- sprintf() - the special codes %V and %U used for HTML and URL escaping respectively.
- http_url() - converts argument to a URL escaping special characters. Result written to internal session.
- http_value() - converts argument to HTML escaping special characters. Result written to internal session.
- current_charset() - returns name of the current charset.

## Examples

1. Use of http().
2. Use of http_value().
3. Use of http_rewrite().
4. Use of http_url().
5. Use of <?= ?> tags.
6. Use of sprintf().