Understanding deployProxy internals - constructor parameters to bytes conversion

I know there us truffle-upgrades to achieve this, but I'm trying to understand how the deployment of a proxy works manually:

Having a contract whose constructor is like ERC721:

constructor(
    string memory name,
    string memory symbol,
    string memory baseTokenURI
)  

an hypotetical ERC1967Proxy constructor needs those parameters encoded in bytes:

    constructor(address _logic, bytes memory _data) payable {

is there a way to manually do this ? how do I encode those parameters in bytes ?

Hey you could do something like what's shown in this thread - basically use something like:

        ERC1967Proxy proxy = new ERC1967Proxy(
            tokenImplementation,
            abi.encodeWithSelector(MyTokenUpgradeable(address(0)).initialize.selector, name, symbol, initialSupply, owner)
        );