It is quite complicated to get this correct, but here's some information on how to work it out.

I'm using a simple contract as an example:

    pragma solidity ^0.4.2;
    
    contract Test {
        uint256 public v1;
        string public v2;
    
        function Test(uint256 _v1, string _v2) {
            v1 = _v1;
            v2 = _v2;
        }
    }

Here is my deployment to a `--dev` blockchain using Browser Solidity:

[![enter image description here][1]][1]

Here's the bytecode from the Browser Solidity:

> 6060604052604051610235380380610235833981016040528051608051909101600082815581516001805492819052916020601f60026000196101008588161502019093169290920482018190047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf69081019392909186019083901060b657805160ff19168380011785555b5060a49291505b8082111560e357600081556001016092565b5050505061014e806100e76000396000f35b82800160010185558215608b579182015b82811115608b57825182600050559160200191906001019060c7565b509056606060405260e060020a60003504636854171d8114610029578063f3acae3a14610037575b610002565b346100025761009b60005481565b34610002576100ad60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281529291908301828280156101465780601f1061011b57610100808354040283529160200191610146565b60408051918252519081900360200190f35b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f16801561010d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b820191906000526020600020905b81548152906001019060200180831161012957829003601f168201915b50505050508156 

Before deploying the contract to the `--dev` blockchain, I ran the command `debug.verbosity(4)` in the `geth` console command line. When Browser Solidity is deploying the contract, the following information is displayed in `geth`:

> I1222 14:09:50.670663 core/tx_pool.go:542] Promoting queued transaction:

> 	TX(92a1308637d6ad0a63b181194701114780afdaacfcd73604a1f7f3b6985b9755)

> 	Contract: false

> 	From:     000d1009bd8f0b1301cc5edc28ed1222a3ce671e

> 	To:       [contract creation]

> 	Nonce:    457

> 	GasPrice: 20000000000

> 	GasLimit  198696

> 	Value:    0

> 	Data:     0x6060604052604051610235380380610235833981016040528051608051909101600082815581516001805492819052916020601f60026000196101008588161502019093169290920482018190047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf69081019392909186019083901060b657805160ff19168380011785555b5060a49291505b8082111560e357600081556001016092565b5050505061014e806100e76000396000f35b82800160010185558215608b579182015b82811115608b57825182600050559160200191906001019060c7565b509056606060405260e060020a60003504636854171d8114610029578063f3acae3a14610037575b610002565b346100025761009b60005481565b34610002576100ad60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281529291908301828280156101465780601f1061011b57610100808354040283529160200191610146565b60408051918252519081900360200190f35b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f16801561010d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b820191906000526020600020905b81548152906001019060200180831161012957829003601f168201915b50505050508156**000000000000000000000000000000000000000000000000000000000000007b0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000d48656c6c6f2c20576f726c642100000000000000000000000000000000000000**

> 	V:        0x1c

> 	R:        0xe84786ff0c0ed7564a972d3e037ef74d9adada759f845f36246e818f987d2945

> 	S:        0x38ce5aa5b1a283f3270acd4668e99d410cd7f65ac74f4ae72416b0068935bd51

> 	Hex:      f9030a8201c98504a817c800830308288080b902b56060604052604051610235380380610235833981016040528051608051909101600082815581516001805492819052916020601f60026000196101008588161502019093169290920482018190047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf69081019392909186019083901060b657805160ff19168380011785555b5060a49291505b8082111560e357600081556001016092565b5050505061014e806100e76000396000f35b82800160010185558215608b579182015b82811115608b57825182600050559160200191906001019060c7565b509056606060405260e060020a60003504636854171d8114610029578063f3acae3a14610037575b610002565b346100025761009b60005481565b34610002576100ad60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281529291908301828280156101465780601f1061011b57610100808354040283529160200191610146565b60408051918252519081900360200190f35b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f16801561010d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b820191906000526020600020905b81548152906001019060200180831161012957829003601f168201915b50505050508156000000000000000000000000000000000000000000000000000000000000007b0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000d48656c6c6f2c20576f726c6421000000000000000000000000000000000000001ca0e84786ff0c0ed7564a972d3e037ef74d9adada759f845f36246e818f987d2945a038ce5aa5b1a283f3270acd4668e99d410cd7f65ac74f4ae72416b0068935bd51

Sending the `Data:` part above as the `data:` parameter in your JSON-RPC [eth_sendTransaction](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendtransaction) transaction will achieve the same action of deploying the contract onto the blockchain with the same constructor arguments.

You can see the first part of the `Data:` field (not bolded) matching the contract bytecode, and the second part of the `Data:` field (bolded) represents the constructor arguments.

The constructor arguments are:

    // _v1: 0x7b = 123
    000000000000000000000000000000000000000000000000000000000000007b
    // 0x40 = 64. This is the offset from the beginning of _v1
    // directly above to the start of the next set of hex strings
    // ending below
    0000000000000000000000000000000000000000000000000000000000000040
    // 0xd = 13 - the length of the "Hello, World!" string
    000000000000000000000000000000000000000000000000000000000000000d
    // In geth, 
    // > web3.toUtf8("48656c6c6f2c20576f726c642100000000000000000000000000000000000000")
    // "Hello, World!"
    48656c6c6f2c20576f726c642100000000000000000000000000000000000000

Further references:

* [Ethereum Contract ABI](https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI)
* http://ethereum.stackexchange.com/questions/10818/how-to-explain-string-serialization-when-invoking-contract-method
* http://ethereum.stackexchange.com/questions/7606/can-you-help-me-parse-this-input-data-from-a-newproposal-transaction-from-the-da for use of the `ethabi` tool
* web3.js - [encodeParams](https://github.com/ethereum/web3.js/blob/master/dist/web3.js#L702), [decodeParams](https://github.com/ethereum/web3.js/blob/master/dist/web3.js#L834), [test encodeParams](https://github.com/ethereum/web3.js/blob/master/test/coder.encodeParam.js), [test decodeParams](https://github.com/ethereum/web3.js/blob/master/test/coder.decodeParam.js)

  [1]: https://i.sstatic.net/N1lUj.png